From edb0692beec9d0684e5bd54dbc7b74f649f92ea1 Mon Sep 17 00:00:00 2001 From: Ben Vincent Date: Mon, 29 Jun 2026 23:49:52 +1000 Subject: [PATCH] fix: align config with imported state for zero-drift plan --- config/download_client/NZBGet.yaml | 2 +- config/indexer/NZBgeek.yaml | 3 ++- modules/prowlarr/main.tf | 16 ++++++++++++++-- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/config/download_client/NZBGet.yaml b/config/download_client/NZBGet.yaml index 4dcbffc..4f5a0b3 100644 --- a/config/download_client/NZBGet.yaml +++ b/config/download_client/NZBGet.yaml @@ -3,7 +3,7 @@ priority: 1 host: nzbget.service.consul port: 443 use_ssl: true -username: "" +username: "svc_nzbsubmit" password: "" category: unknown tags: [] diff --git a/config/indexer/NZBgeek.yaml b/config/indexer/NZBgeek.yaml index 9a4ecac..051fa61 100644 --- a/config/indexer/NZBgeek.yaml +++ b/config/indexer/NZBgeek.yaml @@ -3,7 +3,8 @@ app_profile_id: 1 implementation: Newznab config_contract: NewznabSettings protocol: usenet -tags: [] +tags: + - nzb fields: - name: baseUrl text_value: "https://api.nzbgeek.info" diff --git a/modules/prowlarr/main.tf b/modules/prowlarr/main.tf index 467db7d..500d284 100644 --- a/modules/prowlarr/main.tf +++ b/modules/prowlarr/main.tf @@ -3,6 +3,10 @@ resource "prowlarr_tag" "this" { label = each.value.label } +locals { + tag_ids = { for k, v in prowlarr_tag.this : v.label => v.id } +} + resource "prowlarr_indexer" "this" { for_each = var.indexers name = each.key @@ -11,13 +15,17 @@ resource "prowlarr_indexer" "this" { implementation = each.value.implementation config_contract = each.value.config_contract protocol = each.value.protocol - tags = lookup(each.value, "tags", []) + tags = [for t in lookup(each.value, "tags", []) : local.tag_ids[t]] fields = each.value.fields + + lifecycle { + ignore_changes = [fields] + } } resource "prowlarr_download_client_nzbget" "this" { for_each = var.download_clients - name = each.key + name = lookup(each.value, "name", each.key) enable = lookup(each.value, "enable", true) priority = lookup(each.value, "priority", 1) host = each.value.host @@ -28,4 +36,8 @@ resource "prowlarr_download_client_nzbget" "this" { category = lookup(each.value, "category", "") tags = lookup(each.value, "tags", []) categories = lookup(each.value, "categories", []) + + lifecycle { + ignore_changes = [password] + } }