fe1219878e
Use nested attribute assignment instead of dynamic blocks for specifications, quality_groups, and format_items. Remove unsupported season_search_maximum_single_episode_age from indexer configs. Flatten custom format specifications to use value/min/max directly.
93 lines
4.5 KiB
Terraform
93 lines
4.5 KiB
Terraform
resource "sonarr_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)
|
|
specifications = each.value.specifications
|
|
}
|
|
|
|
resource "sonarr_quality_profile" "this" {
|
|
for_each = var.quality_profiles
|
|
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
|
|
|
|
format_items = [
|
|
for fi in lookup(each.value, "format_items", []) : {
|
|
name = fi.name
|
|
format = sonarr_custom_format.this[fi.format].id
|
|
score = fi.score
|
|
}
|
|
]
|
|
}
|
|
|
|
resource "sonarr_download_client_nzbget" "this" {
|
|
for_each = var.download_clients
|
|
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", "")
|
|
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)
|
|
}
|
|
|
|
resource "sonarr_indexer_newznab" "this" {
|
|
for_each = var.indexers
|
|
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)
|
|
priority = lookup(each.value, "priority", 25)
|
|
base_url = each.value.base_url
|
|
api_path = lookup(each.value, "api_path", "/api")
|
|
api_key = lookup(each.value, "api_key", "")
|
|
categories = lookup(each.value, "categories", [])
|
|
anime_categories = lookup(each.value, "anime_categories", [])
|
|
}
|
|
|
|
resource "sonarr_notification_emby" "this" {
|
|
for_each = var.notifications
|
|
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
|
|
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_series_add = lookup(each.value, "on_series_add", true)
|
|
on_series_delete = lookup(each.value, "on_series_delete", true)
|
|
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)
|
|
}
|
|
|
|
resource "sonarr_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 = each.value.tags
|
|
}
|
|
|
|
resource "sonarr_root_folder" "this" {
|
|
for_each = var.root_folders
|
|
path = each.value.path
|
|
}
|