fix: align config with imported state for zero-drift plan
Reorder quality_groups to match provider state (highest quality first), use correct group structure (omit id/name for single-quality entries), add lifecycle ignore_changes for sensitive fields (api_key, password), support explicit name override via YAML for display name mismatches, and add min_upgrade_format_score attribute.
This commit is contained in:
+20
-7
@@ -19,9 +19,10 @@ resource "sonarr_quality_profile" "this" {
|
||||
name = each.key
|
||||
upgrade_allowed = lookup(each.value, "upgrade_allowed", false)
|
||||
cutoff = each.value.cutoff
|
||||
cutoff_format_score = lookup(each.value, "cutoff_format_score", 0)
|
||||
min_format_score = lookup(each.value, "min_format_score", 0)
|
||||
quality_groups = each.value.quality_groups
|
||||
cutoff_format_score = lookup(each.value, "cutoff_format_score", 0)
|
||||
min_format_score = lookup(each.value, "min_format_score", 0)
|
||||
min_upgrade_format_score = lookup(each.value, "min_upgrade_format_score", 0)
|
||||
quality_groups = each.value.quality_groups
|
||||
|
||||
format_items = [
|
||||
for fi in lookup(each.value, "format_items", []) : {
|
||||
@@ -34,7 +35,7 @@ resource "sonarr_quality_profile" "this" {
|
||||
|
||||
resource "sonarr_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
|
||||
@@ -45,11 +46,15 @@ resource "sonarr_download_client_nzbget" "this" {
|
||||
tv_category = lookup(each.value, "tv_category", "")
|
||||
remove_completed_downloads = lookup(each.value, "remove_completed_downloads", true)
|
||||
remove_failed_downloads = lookup(each.value, "remove_failed_downloads", true)
|
||||
|
||||
lifecycle {
|
||||
ignore_changes = [password]
|
||||
}
|
||||
}
|
||||
|
||||
resource "sonarr_indexer_newznab" "this" {
|
||||
for_each = var.indexers
|
||||
name = each.key
|
||||
name = lookup(each.value, "name", each.key)
|
||||
enable_automatic_search = lookup(each.value, "enable_automatic_search", true)
|
||||
enable_interactive_search = lookup(each.value, "enable_interactive_search", true)
|
||||
enable_rss = lookup(each.value, "enable_rss", true)
|
||||
@@ -59,15 +64,19 @@ resource "sonarr_indexer_newznab" "this" {
|
||||
api_key = lookup(each.value, "api_key", "")
|
||||
categories = lookup(each.value, "categories", [])
|
||||
anime_categories = lookup(each.value, "anime_categories", [])
|
||||
|
||||
lifecycle {
|
||||
ignore_changes = [api_key]
|
||||
}
|
||||
}
|
||||
|
||||
resource "sonarr_notification_emby" "this" {
|
||||
for_each = var.notifications
|
||||
name = each.key
|
||||
name = lookup(each.value, "name", each.key)
|
||||
host = each.value.host
|
||||
port = each.value.port
|
||||
use_ssl = lookup(each.value, "use_ssl", false)
|
||||
api_key = each.value.api_key
|
||||
api_key = lookup(each.value, "api_key", "")
|
||||
notify = lookup(each.value, "notify", false)
|
||||
update_library = lookup(each.value, "update_library", true)
|
||||
|
||||
@@ -80,6 +89,10 @@ resource "sonarr_notification_emby" "this" {
|
||||
on_episode_file_delete = lookup(each.value, "on_episode_file_delete", true)
|
||||
on_episode_file_delete_for_upgrade = lookup(each.value, "on_episode_file_delete_for_upgrade", true)
|
||||
on_application_update = lookup(each.value, "on_application_update", true)
|
||||
|
||||
lifecycle {
|
||||
ignore_changes = [api_key]
|
||||
}
|
||||
}
|
||||
|
||||
resource "sonarr_delay_profile" "this" {
|
||||
|
||||
Reference in New Issue
Block a user