diff --git a/config/custom_format/size_0_800.yaml b/config/custom_format/size_0_800.yaml deleted file mode 100644 index 66ed03b..0000000 --- a/config/custom_format/size_0_800.yaml +++ /dev/null @@ -1,8 +0,0 @@ -include_custom_format_when_renaming: false -specifications: -- name: size_0_800 - implementation: SizeSpecification - negate: false - required: false - min: 0 - max: 0.8 diff --git a/config/custom_format/size_1500_3000.yaml b/config/custom_format/size_1500_3000.yaml deleted file mode 100644 index df3a550..0000000 --- a/config/custom_format/size_1500_3000.yaml +++ /dev/null @@ -1,8 +0,0 @@ -include_custom_format_when_renaming: false -specifications: -- name: size_1500_3000 - implementation: SizeSpecification - negate: false - required: false - min: 1.5 - max: 3 diff --git a/config/custom_format/size_3000_6000.yaml b/config/custom_format/size_3000_6000.yaml deleted file mode 100644 index 1f19989..0000000 --- a/config/custom_format/size_3000_6000.yaml +++ /dev/null @@ -1,8 +0,0 @@ -include_custom_format_when_renaming: false -specifications: -- name: size_3000_6000 - implementation: SizeSpecification - negate: false - required: false - min: 3 - max: 6 diff --git a/config/custom_format/size_6000_10000.yaml b/config/custom_format/size_6000_10000.yaml deleted file mode 100644 index b7fdfd4..0000000 --- a/config/custom_format/size_6000_10000.yaml +++ /dev/null @@ -1,8 +0,0 @@ -include_custom_format_when_renaming: false -specifications: -- name: size_6000_10000 - implementation: SizeSpecification - negate: false - required: false - min: 6 - max: 10 diff --git a/config/custom_format/size_800_1500.yaml b/config/custom_format/size_800_1500.yaml deleted file mode 100644 index bd9f923..0000000 --- a/config/custom_format/size_800_1500.yaml +++ /dev/null @@ -1,8 +0,0 @@ -include_custom_format_when_renaming: false -specifications: -- name: size_800_1500 - implementation: SizeSpecification - negate: false - required: false - min: 0.8 - max: 1.5 diff --git a/modules/sonarr/main.tf b/modules/sonarr/main.tf index 86598ae..6e61c55 100644 --- a/modules/sonarr/main.tf +++ b/modules/sonarr/main.tf @@ -5,6 +5,15 @@ resource "sonarr_custom_format" "this" { specifications = each.value.specifications } +data "sonarr_custom_formats" "all" {} + +locals { + custom_format_ids = merge( + { for cf in data.sonarr_custom_formats.all.custom_formats : cf.name => cf.id }, + { for k, v in sonarr_custom_format.this : k => v.id }, + ) +} + resource "sonarr_quality_profile" "this" { for_each = var.quality_profiles name = each.key @@ -17,7 +26,7 @@ resource "sonarr_quality_profile" "this" { format_items = [ for fi in lookup(each.value, "format_items", []) : { name = fi.name - format = sonarr_custom_format.this[fi.format].id + format = local.custom_format_ids[fi.format] score = fi.score } ] diff --git a/modules/sonarr/variables.tf b/modules/sonarr/variables.tf index 67d117a..1782c9f 100644 --- a/modules/sonarr/variables.tf +++ b/modules/sonarr/variables.tf @@ -1,34 +1,34 @@ variable "custom_formats" { - type = map(any) + type = any default = {} } variable "quality_profiles" { - type = map(any) + type = any default = {} } variable "download_clients" { - type = map(any) + type = any default = {} } variable "indexers" { - type = map(any) + type = any default = {} } variable "notifications" { - type = map(any) + type = any default = {} } variable "delay_profiles" { - type = map(any) + type = any default = {} } variable "root_folders" { - type = map(any) + type = any default = {} }