fix: align terraform resources with actual provider schema
Use nested attribute assignment instead of dynamic blocks for specifications, quality_groups, and format_items. Add required language field to quality profiles. Remove unsupported delay_profile fields. Flatten custom format specifications to use value/min/max directly.
This commit is contained in:
+26
-63
@@ -2,24 +2,7 @@ resource "radarr_custom_format" "this" {
|
||||
for_each = var.custom_formats
|
||||
name = each.key
|
||||
include_custom_format_when_renaming = lookup(each.value, "include_custom_format_when_renaming", false)
|
||||
|
||||
dynamic "specifications" {
|
||||
for_each = each.value.specifications
|
||||
content {
|
||||
name = specifications.value.name
|
||||
implementation = specifications.value.implementation
|
||||
negate = lookup(specifications.value, "negate", false)
|
||||
required = lookup(specifications.value, "required", false)
|
||||
|
||||
dynamic "fields" {
|
||||
for_each = lookup(specifications.value, "fields", [])
|
||||
content {
|
||||
name = fields.value.name
|
||||
value = tostring(lookup(fields.value, "value", ""))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
specifications = each.value.specifications
|
||||
}
|
||||
|
||||
resource "radarr_quality_profile" "this" {
|
||||
@@ -29,33 +12,16 @@ resource "radarr_quality_profile" "this" {
|
||||
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
|
||||
language = each.value.language
|
||||
|
||||
dynamic "quality_groups" {
|
||||
for_each = each.value.quality_groups
|
||||
content {
|
||||
id = quality_groups.value.id
|
||||
name = lookup(quality_groups.value, "name", null)
|
||||
|
||||
dynamic "qualities" {
|
||||
for_each = quality_groups.value.qualities
|
||||
content {
|
||||
id = qualities.value.id
|
||||
name = qualities.value.name
|
||||
source = qualities.value.source
|
||||
resolution = qualities.value.resolution
|
||||
}
|
||||
}
|
||||
format_items = [
|
||||
for fi in lookup(each.value, "format_items", []) : {
|
||||
name = fi.name
|
||||
format = radarr_custom_format.this[fi.format].id
|
||||
score = fi.score
|
||||
}
|
||||
}
|
||||
|
||||
dynamic "format_items" {
|
||||
for_each = lookup(each.value, "format_items", [])
|
||||
content {
|
||||
name = format_items.value.name
|
||||
format = format_items.value.format
|
||||
score = format_items.value.score
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
resource "radarr_download_client_nzbget" "this" {
|
||||
@@ -84,7 +50,6 @@ resource "radarr_indexer_newznab" "this" {
|
||||
api_path = lookup(each.value, "api_path", "/api")
|
||||
api_key = lookup(each.value, "api_key", "")
|
||||
categories = lookup(each.value, "categories", [])
|
||||
download_client_id = lookup(each.value, "download_client_id", 0)
|
||||
}
|
||||
|
||||
resource "radarr_notification_emby" "this" {
|
||||
@@ -93,31 +58,29 @@ resource "radarr_notification_emby" "this" {
|
||||
host = each.value.host
|
||||
port = each.value.port
|
||||
use_ssl = lookup(each.value, "use_ssl", false)
|
||||
api_key = lookup(each.value, "api_key", "")
|
||||
api_key = each.value.api_key
|
||||
notify = lookup(each.value, "notify", false)
|
||||
update_library = lookup(each.value, "update_library", true)
|
||||
|
||||
on_grab = lookup(each.value, "on_grab", true)
|
||||
on_download = lookup(each.value, "on_download", true)
|
||||
on_upgrade = lookup(each.value, "on_upgrade", true)
|
||||
on_rename = lookup(each.value, "on_rename", true)
|
||||
on_movie_delete = lookup(each.value, "on_movie_delete", true)
|
||||
on_movie_file_delete = lookup(each.value, "on_movie_file_delete", true)
|
||||
on_movie_file_delete_for_upgrade = lookup(each.value, "on_movie_file_delete_for_upgrade", true)
|
||||
on_application_update = lookup(each.value, "on_application_update", true)
|
||||
on_grab = lookup(each.value, "on_grab", true)
|
||||
on_download = lookup(each.value, "on_download", true)
|
||||
on_upgrade = lookup(each.value, "on_upgrade", true)
|
||||
on_rename = lookup(each.value, "on_rename", true)
|
||||
on_movie_delete = each.value.on_movie_delete
|
||||
on_movie_file_delete = lookup(each.value, "on_movie_file_delete", true)
|
||||
on_movie_file_delete_for_upgrade = lookup(each.value, "on_movie_file_delete_for_upgrade", true)
|
||||
on_application_update = lookup(each.value, "on_application_update", true)
|
||||
}
|
||||
|
||||
resource "radarr_delay_profile" "this" {
|
||||
for_each = var.delay_profiles
|
||||
enable_usenet = lookup(each.value, "enable_usenet", true)
|
||||
enable_torrent = lookup(each.value, "enable_torrent", true)
|
||||
preferred_protocol = lookup(each.value, "preferred_protocol", "usenet")
|
||||
usenet_delay = lookup(each.value, "usenet_delay", 0)
|
||||
torrent_delay = lookup(each.value, "torrent_delay", 0)
|
||||
bypass_if_highest_quality = lookup(each.value, "bypass_if_highest_quality", true)
|
||||
bypass_if_above_custom_format_score = lookup(each.value, "bypass_if_above_custom_format_score", false)
|
||||
minimum_custom_format_score = lookup(each.value, "minimum_custom_format_score", 0)
|
||||
tags = lookup(each.value, "tags", [])
|
||||
for_each = var.delay_profiles
|
||||
enable_usenet = lookup(each.value, "enable_usenet", true)
|
||||
enable_torrent = lookup(each.value, "enable_torrent", true)
|
||||
preferred_protocol = lookup(each.value, "preferred_protocol", "usenet")
|
||||
usenet_delay = lookup(each.value, "usenet_delay", 0)
|
||||
torrent_delay = lookup(each.value, "torrent_delay", 0)
|
||||
bypass_if_highest_quality = lookup(each.value, "bypass_if_highest_quality", true)
|
||||
tags = each.value.tags
|
||||
}
|
||||
|
||||
resource "radarr_root_folder" "this" {
|
||||
|
||||
Reference in New Issue
Block a user