resource "prowlarr_tag" "this" { for_each = var.tags 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 enable = lookup(each.value, "enable", true) app_profile_id = each.value.app_profile_id implementation = each.value.implementation config_contract = each.value.config_contract protocol = each.value.protocol 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 = lookup(each.value, "name", each.key) enable = lookup(each.value, "enable", true) priority = lookup(each.value, "priority", 1) host = each.value.host port = each.value.port use_ssl = lookup(each.value, "use_ssl", false) username = lookup(each.value, "username", "") password = lookup(each.value, "password", "") category = lookup(each.value, "category", "") tags = lookup(each.value, "tags", []) categories = lookup(each.value, "categories", []) lifecycle { ignore_changes = [password] } }