fix: use data source for size custom formats to work around provider set key bug
ci/woodpecker/pr/pre-commit Pipeline failed
ci/woodpecker/pr/plan Pipeline was successful

The devopsarr sonarr provider cannot handle float min/max values in
SizeSpecification as set element keys. Remove size custom formats from
terraform management and look up their IDs via a data source instead.
Also change variable types from map(any) to any to allow heterogeneous
quality profile structures.
This commit is contained in:
2026-06-28 23:31:38 +10:00
parent fe1219878e
commit 81b28c72b1
7 changed files with 17 additions and 48 deletions
-8
View File
@@ -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
-8
View File
@@ -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
-8
View File
@@ -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
@@ -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
-8
View File
@@ -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
+10 -1
View File
@@ -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
}
]
+7 -7
View File
@@ -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 = {}
}