feat: initial sonarr terraform configuration
This commit is contained in:
@@ -0,0 +1,128 @@
|
||||
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)
|
||||
|
||||
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", ""))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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 "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", [])
|
||||
season_search_maximum_single_episode_age = lookup(each.value, "season_search_maximum_single_episode_age", 0)
|
||||
}
|
||||
|
||||
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 = lookup(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 = lookup(each.value, "tags", [])
|
||||
}
|
||||
|
||||
resource "sonarr_root_folder" "this" {
|
||||
for_each = var.root_folders
|
||||
path = each.value.path
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
variable "custom_formats" {
|
||||
type = map(any)
|
||||
default = {}
|
||||
}
|
||||
|
||||
variable "quality_profiles" {
|
||||
type = map(any)
|
||||
default = {}
|
||||
}
|
||||
|
||||
variable "download_clients" {
|
||||
type = map(any)
|
||||
default = {}
|
||||
}
|
||||
|
||||
variable "indexers" {
|
||||
type = map(any)
|
||||
default = {}
|
||||
}
|
||||
|
||||
variable "notifications" {
|
||||
type = map(any)
|
||||
default = {}
|
||||
}
|
||||
|
||||
variable "delay_profiles" {
|
||||
type = map(any)
|
||||
default = {}
|
||||
}
|
||||
|
||||
variable "root_folders" {
|
||||
type = map(any)
|
||||
default = {}
|
||||
}
|
||||
Reference in New Issue
Block a user