From a00affbf46e4670d278741296d6a544b64211fa9 Mon Sep 17 00:00:00 2001 From: Ben Vincent Date: Sun, 28 Jun 2026 22:17:12 +1000 Subject: [PATCH 1/7] feat: initial radarr terraform configuration --- .gitignore | 6 + .pre-commit-config.yaml | 24 ++++ .woodpecker/apply.yaml | 23 ++++ .woodpecker/plan.yaml | 21 +++ .woodpecker/pre-commit.yaml | 18 +++ Makefile | 35 +++++ config/config.hcl | 46 +++++++ config/custom_format/1080p.yaml | 9 ++ config/custom_format/2160p.yaml | 9 ++ config/custom_format/720p.yaml | 9 ++ config/custom_format/x264.yaml | 9 ++ config/custom_format/x265.yaml | 9 ++ config/delay_profile/default.yaml | 9 ++ config/download_client/NZBGet.yaml | 10 ++ config/indexer/NZBgeek_Prowlarr.yaml | 17 +++ config/notification/Jellyfin.yaml | 14 ++ config/quality_profile/BestQuality_1080p.yaml | 78 +++++++++++ config/quality_profile/BestQuality_2160p.yaml | 36 +++++ config/quality_profile/DONT_USE_WEBDL.yaml | 32 +++++ config/root_folder/movies.yaml | 1 + .../radarr.service.consul/terragrunt.hcl | 27 ++++ environments/root.hcl | 32 +++++ modules/radarr/main.tf | 126 ++++++++++++++++++ modules/radarr/variables.tf | 34 +++++ 24 files changed, 634 insertions(+) create mode 100644 .gitignore create mode 100644 .pre-commit-config.yaml create mode 100644 .woodpecker/apply.yaml create mode 100644 .woodpecker/plan.yaml create mode 100644 .woodpecker/pre-commit.yaml create mode 100644 Makefile create mode 100644 config/config.hcl create mode 100644 config/custom_format/1080p.yaml create mode 100644 config/custom_format/2160p.yaml create mode 100644 config/custom_format/720p.yaml create mode 100644 config/custom_format/x264.yaml create mode 100644 config/custom_format/x265.yaml create mode 100644 config/delay_profile/default.yaml create mode 100644 config/download_client/NZBGet.yaml create mode 100644 config/indexer/NZBgeek_Prowlarr.yaml create mode 100644 config/notification/Jellyfin.yaml create mode 100644 config/quality_profile/BestQuality_1080p.yaml create mode 100644 config/quality_profile/BestQuality_2160p.yaml create mode 100644 config/quality_profile/DONT_USE_WEBDL.yaml create mode 100644 config/root_folder/movies.yaml create mode 100644 environments/radarr.service.consul/terragrunt.hcl create mode 100644 environments/root.hcl create mode 100644 modules/radarr/main.tf create mode 100644 modules/radarr/variables.tf diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..13275b0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +.terraform/ +*.tfstate +*.tfstate.backup +*.tfplan +backend.tf +.terragrunt-cache/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..646cd65 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,24 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.4.0 + hooks: + - id: end-of-file-fixer + types: [yaml] + - id: trailing-whitespace + types: [yaml] + - repo: https://github.com/gruntwork-io/pre-commit + rev: v0.1.30 + hooks: + - id: tofu-fmt + - id: tofu-validate + - id: tflint + - id: terragrunt-hcl-fmt + - repo: https://github.com/adrienverge/yamllint.git + rev: v1.37.1 + hooks: + - id: yamllint + args: + [ + "-d {extends: relaxed, rules: {line-length: disable}, ignore: chart}", + "-s", + ] diff --git a/.woodpecker/apply.yaml b/.woodpecker/apply.yaml new file mode 100644 index 0000000..1f17ac4 --- /dev/null +++ b/.woodpecker/apply.yaml @@ -0,0 +1,23 @@ +when: + - event: push + branch: main + +steps: + - name: apply + image: git.unkin.net/unkin/almalinux9-opentofu:20260606 + environment: + VAULT_AUTH_METHOD: kubernetes + commands: + - dnf install vault -y + - make plan + - make apply + backend_options: + kubernetes: + serviceAccountName: terraform-radarr + resources: + requests: + memory: 512Mi + cpu: 1 + limits: + memory: 2Gi + cpu: 2 diff --git a/.woodpecker/plan.yaml b/.woodpecker/plan.yaml new file mode 100644 index 0000000..f6c4432 --- /dev/null +++ b/.woodpecker/plan.yaml @@ -0,0 +1,21 @@ +when: + - event: pull_request + +steps: + - name: plan + image: git.unkin.net/unkin/almalinux9-opentofu:20260606 + environment: + VAULT_AUTH_METHOD: kubernetes + commands: + - dnf install vault -y + - make plan + backend_options: + kubernetes: + serviceAccountName: terraform-radarr + resources: + requests: + memory: 512Mi + cpu: 1 + limits: + memory: 2Gi + cpu: 2 diff --git a/.woodpecker/pre-commit.yaml b/.woodpecker/pre-commit.yaml new file mode 100644 index 0000000..5c5738f --- /dev/null +++ b/.woodpecker/pre-commit.yaml @@ -0,0 +1,18 @@ +when: + - event: pull_request + +steps: + - name: pre-commit + image: git.unkin.net/unkin/almalinux9-opentofu:20260606 + commands: + - uvx pre-commit run --all-files + backend_options: + kubernetes: + serviceAccountName: default + resources: + requests: + memory: 512Mi + cpu: 1 + limits: + memory: 2Gi + cpu: 2 diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..de15058 --- /dev/null +++ b/Makefile @@ -0,0 +1,35 @@ +.PHONY: init plan apply format + +VAULT_AUTH_METHOD ?= approle +VAULT_K8S_ROLE ?= woodpecker_terraform_radarr +VAULT_K8S_MOUNT ?= auth/k8s/au/syd1 +VAULT_K8S_JWT_PATH ?= /var/run/secrets/kubernetes.io/serviceaccount/token + +define vault_env + @export VAULT_ADDR="https://vault.service.consul:8200" && \ + if [ "$(VAULT_AUTH_METHOD)" = "kubernetes" ]; then \ + export VAULT_TOKEN=$$(vault write -field=token $(VAULT_K8S_MOUNT)/login role=$(VAULT_K8S_ROLE) jwt=$$(cat $(VAULT_K8S_JWT_PATH))); \ + else \ + export VAULT_TOKEN=$$(vault write -field=token auth/approle/login role_id=$$VAULT_ROLEID); \ + fi && \ + export CONSUL_HTTP_TOKEN=$$(vault read -field=token consul_root/au/syd1/creds/terraform-radarr) && \ + export RADARR_API_KEY=$$(vault kv get -field=apitoken kv/service/media-apps/radarr) +endef + +init: + @$(call vault_env) && \ + terragrunt run --all --non-interactive init -- -upgrade + +plan: init + @$(call vault_env) && \ + terragrunt run --all --parallelism 4 --non-interactive plan + +apply: init + @$(call vault_env) && \ + terragrunt run --all --parallelism 2 --non-interactive apply + +format: + @echo "Formatting OpenTofu files..." + @tofu fmt -recursive . + @echo "Formatting Terragrunt files..." + @terragrunt hcl fmt diff --git a/config/config.hcl b/config/config.hcl new file mode 100644 index 0000000..d112876 --- /dev/null +++ b/config/config.hcl @@ -0,0 +1,46 @@ +locals { + config_files = fileset(".", "**/*.yaml") + + all_configs = { + for file_path in local.config_files : + file_path => yamldecode(file(file_path)) + } + + config = { + custom_formats = { + for file_path, content in local.all_configs : + trimsuffix(basename(file_path), ".yaml") => content + if startswith(file_path, "custom_format/") + } + quality_profiles = { + for file_path, content in local.all_configs : + trimsuffix(basename(file_path), ".yaml") => content + if startswith(file_path, "quality_profile/") + } + download_clients = { + for file_path, content in local.all_configs : + trimsuffix(basename(file_path), ".yaml") => content + if startswith(file_path, "download_client/") + } + indexers = { + for file_path, content in local.all_configs : + trimsuffix(basename(file_path), ".yaml") => content + if startswith(file_path, "indexer/") + } + notifications = { + for file_path, content in local.all_configs : + trimsuffix(basename(file_path), ".yaml") => content + if startswith(file_path, "notification/") + } + delay_profiles = { + for file_path, content in local.all_configs : + trimsuffix(basename(file_path), ".yaml") => content + if startswith(file_path, "delay_profile/") + } + root_folders = { + for file_path, content in local.all_configs : + trimsuffix(basename(file_path), ".yaml") => content + if startswith(file_path, "root_folder/") + } + } +} diff --git a/config/custom_format/1080p.yaml b/config/custom_format/1080p.yaml new file mode 100644 index 0000000..b0343e5 --- /dev/null +++ b/config/custom_format/1080p.yaml @@ -0,0 +1,9 @@ +include_custom_format_when_renaming: false +specifications: + - name: 1080p + implementation: ResolutionSpecification + negate: false + required: false + fields: + - name: value + value: "1080" diff --git a/config/custom_format/2160p.yaml b/config/custom_format/2160p.yaml new file mode 100644 index 0000000..c554727 --- /dev/null +++ b/config/custom_format/2160p.yaml @@ -0,0 +1,9 @@ +include_custom_format_when_renaming: false +specifications: + - name: 2160p + implementation: ResolutionSpecification + negate: false + required: false + fields: + - name: value + value: "2160" diff --git a/config/custom_format/720p.yaml b/config/custom_format/720p.yaml new file mode 100644 index 0000000..3661b07 --- /dev/null +++ b/config/custom_format/720p.yaml @@ -0,0 +1,9 @@ +include_custom_format_when_renaming: false +specifications: + - name: 720p + implementation: ResolutionSpecification + negate: false + required: false + fields: + - name: value + value: "720" diff --git a/config/custom_format/x264.yaml b/config/custom_format/x264.yaml new file mode 100644 index 0000000..b16d308 --- /dev/null +++ b/config/custom_format/x264.yaml @@ -0,0 +1,9 @@ +include_custom_format_when_renaming: false +specifications: + - name: x264 + implementation: ReleaseTitleSpecification + negate: false + required: false + fields: + - name: value + value: "(x|h)\\.?264" diff --git a/config/custom_format/x265.yaml b/config/custom_format/x265.yaml new file mode 100644 index 0000000..bb0e8b5 --- /dev/null +++ b/config/custom_format/x265.yaml @@ -0,0 +1,9 @@ +include_custom_format_when_renaming: false +specifications: + - name: x265 + implementation: ReleaseTitleSpecification + negate: false + required: false + fields: + - name: value + value: "(((x|h)\\.?265)|(HEVC))" diff --git a/config/delay_profile/default.yaml b/config/delay_profile/default.yaml new file mode 100644 index 0000000..e4256b6 --- /dev/null +++ b/config/delay_profile/default.yaml @@ -0,0 +1,9 @@ +enable_usenet: true +enable_torrent: true +preferred_protocol: usenet +usenet_delay: 0 +torrent_delay: 0 +bypass_if_highest_quality: true +bypass_if_above_custom_format_score: false +minimum_custom_format_score: 0 +tags: [] diff --git a/config/download_client/NZBGet.yaml b/config/download_client/NZBGet.yaml new file mode 100644 index 0000000..a79ea9f --- /dev/null +++ b/config/download_client/NZBGet.yaml @@ -0,0 +1,10 @@ +enable: true +priority: 1 +host: nzbget.service.consul +port: 443 +use_ssl: true +username: "" +password: "" +movie_category: movies +remove_completed_downloads: true +remove_failed_downloads: true diff --git a/config/indexer/NZBgeek_Prowlarr.yaml b/config/indexer/NZBgeek_Prowlarr.yaml new file mode 100644 index 0000000..610f3c0 --- /dev/null +++ b/config/indexer/NZBgeek_Prowlarr.yaml @@ -0,0 +1,17 @@ +enable_automatic_search: true +enable_interactive_search: true +enable_rss: true +priority: 25 +base_url: "https://prowlarr.service.consul/1/" +api_path: "/api" +api_key: "" +categories: + - 2000 + - 2010 + - 2020 + - 2030 + - 2040 + - 2045 + - 2050 + - 2060 +download_client_id: 0 diff --git a/config/notification/Jellyfin.yaml b/config/notification/Jellyfin.yaml new file mode 100644 index 0000000..e33a43d --- /dev/null +++ b/config/notification/Jellyfin.yaml @@ -0,0 +1,14 @@ +host: jellyfin.service.consul +port: 443 +use_ssl: true +api_key: "" +notify: false +update_library: true +on_grab: true +on_download: true +on_upgrade: true +on_rename: true +on_movie_delete: true +on_movie_file_delete: true +on_movie_file_delete_for_upgrade: true +on_application_update: true diff --git a/config/quality_profile/BestQuality_1080p.yaml b/config/quality_profile/BestQuality_1080p.yaml new file mode 100644 index 0000000..09f7a7e --- /dev/null +++ b/config/quality_profile/BestQuality_1080p.yaml @@ -0,0 +1,78 @@ +upgrade_allowed: true +cutoff: 7 +cutoff_format_score: 5000 +min_format_score: 0 +quality_groups: + - id: 20 + qualities: + - id: 20 + name: Bluray-480p + source: bluray + resolution: 480 + - id: 21 + qualities: + - id: 21 + name: Bluray-576p + source: bluray + resolution: 576 + - id: 4 + qualities: + - id: 4 + name: HDTV-720p + source: tv + resolution: 720 + - id: 5 + qualities: + - id: 5 + name: WEBDL-720p + source: webdl + resolution: 720 + - id: 14 + qualities: + - id: 14 + name: WEBRip-720p + source: webrip + resolution: 720 + - id: 6 + qualities: + - id: 6 + name: Bluray-720p + source: bluray + resolution: 720 + - id: 9 + qualities: + - id: 9 + name: HDTV-1080p + source: tv + resolution: 1080 + - id: 3 + qualities: + - id: 3 + name: WEBDL-1080p + source: webdl + resolution: 1080 + - id: 15 + qualities: + - id: 15 + name: WEBRip-1080p + source: webrip + resolution: 1080 + - id: 7 + qualities: + - id: 7 + name: Bluray-1080p + source: bluray + resolution: 1080 +format_items: + - name: x264 + format: x264 + score: -200 + - name: x265 + format: x265 + score: 1000 + - name: 1080p + format: 1080p + score: 500 + - name: 720p + format: 720p + score: 200 diff --git a/config/quality_profile/BestQuality_2160p.yaml b/config/quality_profile/BestQuality_2160p.yaml new file mode 100644 index 0000000..3b50c9b --- /dev/null +++ b/config/quality_profile/BestQuality_2160p.yaml @@ -0,0 +1,36 @@ +upgrade_allowed: true +cutoff: 19 +cutoff_format_score: 5000 +min_format_score: 0 +quality_groups: + - id: 18 + qualities: + - id: 18 + name: WEBDL-2160p + source: webdl + resolution: 2160 + - id: 17 + qualities: + - id: 17 + name: WEBRip-2160p + source: webrip + resolution: 2160 + - id: 19 + qualities: + - id: 19 + name: Bluray-2160p + source: bluray + resolution: 2160 +format_items: + - name: 2160p + format: 2160p + score: 2000 + - name: 1080p + format: 1080p + score: 500 + - name: x265 + format: x265 + score: 2000 + - name: x264 + format: x264 + score: -5000 diff --git a/config/quality_profile/DONT_USE_WEBDL.yaml b/config/quality_profile/DONT_USE_WEBDL.yaml new file mode 100644 index 0000000..2b0f24a --- /dev/null +++ b/config/quality_profile/DONT_USE_WEBDL.yaml @@ -0,0 +1,32 @@ +upgrade_allowed: true +cutoff: 1002 +cutoff_format_score: 300 +min_format_score: 300 +quality_groups: + - id: 1002 + name: "WEB 1080p" + qualities: + - id: 3 + name: WEBDL-1080p + source: webdl + resolution: 1080 + - id: 15 + name: WEBRip-1080p + source: webrip + resolution: 1080 +format_items: + - name: 2160p + format: 2160p + score: -300 + - name: x264 + format: x264 + score: -200 + - name: x265 + format: x265 + score: -200 + - name: 1080p + format: 1080p + score: -200 + - name: 720p + format: 720p + score: 300 diff --git a/config/root_folder/movies.yaml b/config/root_folder/movies.yaml new file mode 100644 index 0000000..b5e35aa --- /dev/null +++ b/config/root_folder/movies.yaml @@ -0,0 +1 @@ +path: "/shared/media/movies" diff --git a/environments/radarr.service.consul/terragrunt.hcl b/environments/radarr.service.consul/terragrunt.hcl new file mode 100644 index 0000000..75747fd --- /dev/null +++ b/environments/radarr.service.consul/terragrunt.hcl @@ -0,0 +1,27 @@ +include "root" { + path = find_in_parent_folders("root.hcl") + expose = true +} + +include "config" { + path = "${get_repo_root()}/config/config.hcl" + expose = true +} + +locals { + config = include.config.locals.config +} + +terraform { + source = "../../modules/radarr" +} + +inputs = { + custom_formats = local.config.custom_formats + quality_profiles = local.config.quality_profiles + download_clients = local.config.download_clients + indexers = local.config.indexers + notifications = local.config.notifications + delay_profiles = local.config.delay_profiles + root_folders = local.config.root_folders +} diff --git a/environments/root.hcl b/environments/root.hcl new file mode 100644 index 0000000..69e68cd --- /dev/null +++ b/environments/root.hcl @@ -0,0 +1,32 @@ +generate "backend" { + path = "backend.tf" + if_exists = "overwrite" + contents = < Date: Sun, 28 Jun 2026 22:20:23 +1000 Subject: [PATCH 2/7] fix: use TF_VAR_radarr_api_key for terraform variable injection The generated backend.tf defines a terraform variable, so the Makefile must export the API key as TF_VAR_radarr_api_key rather than RADARR_API_KEY. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index de15058..fa4a832 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ define vault_env export VAULT_TOKEN=$$(vault write -field=token auth/approle/login role_id=$$VAULT_ROLEID); \ fi && \ export CONSUL_HTTP_TOKEN=$$(vault read -field=token consul_root/au/syd1/creds/terraform-radarr) && \ - export RADARR_API_KEY=$$(vault kv get -field=apitoken kv/service/media-apps/radarr) + export TF_VAR_radarr_api_key=$$(vault kv get -field=apitoken kv/service/media-apps/radarr) endef init: -- 2.47.3 From a70b902e3be1b65ce2c870628717801e4292a88d Mon Sep 17 00:00:00 2001 From: Ben Vincent Date: Sun, 28 Jun 2026 22:27:49 +1000 Subject: [PATCH 3/7] 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. --- config/custom_format/1080p.yaml | 12 +- config/custom_format/2160p.yaml | 12 +- config/custom_format/720p.yaml | 12 +- config/custom_format/x264.yaml | 12 +- config/custom_format/x265.yaml | 12 +- config/delay_profile/default.yaml | 2 - config/indexer/NZBgeek_Prowlarr.yaml | 1 - config/quality_profile/BestQuality_1080p.yaml | 127 +++++++++--------- config/quality_profile/BestQuality_2160p.yaml | 57 ++++---- config/quality_profile/DONT_USE_WEBDL.yaml | 55 ++++---- .../radarr.service.consul/.terraform.lock.hcl | 25 ++++ modules/radarr/main.tf | 89 ++++-------- 12 files changed, 200 insertions(+), 216 deletions(-) create mode 100644 environments/radarr.service.consul/.terraform.lock.hcl diff --git a/config/custom_format/1080p.yaml b/config/custom_format/1080p.yaml index b0343e5..b5bf75d 100644 --- a/config/custom_format/1080p.yaml +++ b/config/custom_format/1080p.yaml @@ -1,9 +1,7 @@ include_custom_format_when_renaming: false specifications: - - name: 1080p - implementation: ResolutionSpecification - negate: false - required: false - fields: - - name: value - value: "1080" +- name: 1080p + implementation: ResolutionSpecification + negate: false + required: false + value: '1080' diff --git a/config/custom_format/2160p.yaml b/config/custom_format/2160p.yaml index c554727..9f759b7 100644 --- a/config/custom_format/2160p.yaml +++ b/config/custom_format/2160p.yaml @@ -1,9 +1,7 @@ include_custom_format_when_renaming: false specifications: - - name: 2160p - implementation: ResolutionSpecification - negate: false - required: false - fields: - - name: value - value: "2160" +- name: 2160p + implementation: ResolutionSpecification + negate: false + required: false + value: '2160' diff --git a/config/custom_format/720p.yaml b/config/custom_format/720p.yaml index 3661b07..4a16fa7 100644 --- a/config/custom_format/720p.yaml +++ b/config/custom_format/720p.yaml @@ -1,9 +1,7 @@ include_custom_format_when_renaming: false specifications: - - name: 720p - implementation: ResolutionSpecification - negate: false - required: false - fields: - - name: value - value: "720" +- name: 720p + implementation: ResolutionSpecification + negate: false + required: false + value: '720' diff --git a/config/custom_format/x264.yaml b/config/custom_format/x264.yaml index b16d308..a06824e 100644 --- a/config/custom_format/x264.yaml +++ b/config/custom_format/x264.yaml @@ -1,9 +1,7 @@ include_custom_format_when_renaming: false specifications: - - name: x264 - implementation: ReleaseTitleSpecification - negate: false - required: false - fields: - - name: value - value: "(x|h)\\.?264" +- name: x264 + implementation: ReleaseTitleSpecification + negate: false + required: false + value: (x|h)\.?264 diff --git a/config/custom_format/x265.yaml b/config/custom_format/x265.yaml index bb0e8b5..e357a62 100644 --- a/config/custom_format/x265.yaml +++ b/config/custom_format/x265.yaml @@ -1,9 +1,7 @@ include_custom_format_when_renaming: false specifications: - - name: x265 - implementation: ReleaseTitleSpecification - negate: false - required: false - fields: - - name: value - value: "(((x|h)\\.?265)|(HEVC))" +- name: x265 + implementation: ReleaseTitleSpecification + negate: false + required: false + value: (((x|h)\.?265)|(HEVC)) diff --git a/config/delay_profile/default.yaml b/config/delay_profile/default.yaml index e4256b6..9e5e19f 100644 --- a/config/delay_profile/default.yaml +++ b/config/delay_profile/default.yaml @@ -4,6 +4,4 @@ preferred_protocol: usenet usenet_delay: 0 torrent_delay: 0 bypass_if_highest_quality: true -bypass_if_above_custom_format_score: false -minimum_custom_format_score: 0 tags: [] diff --git a/config/indexer/NZBgeek_Prowlarr.yaml b/config/indexer/NZBgeek_Prowlarr.yaml index 610f3c0..cc2c8ce 100644 --- a/config/indexer/NZBgeek_Prowlarr.yaml +++ b/config/indexer/NZBgeek_Prowlarr.yaml @@ -14,4 +14,3 @@ categories: - 2045 - 2050 - 2060 -download_client_id: 0 diff --git a/config/quality_profile/BestQuality_1080p.yaml b/config/quality_profile/BestQuality_1080p.yaml index 09f7a7e..d5173f6 100644 --- a/config/quality_profile/BestQuality_1080p.yaml +++ b/config/quality_profile/BestQuality_1080p.yaml @@ -3,76 +3,79 @@ cutoff: 7 cutoff_format_score: 5000 min_format_score: 0 quality_groups: +- id: 20 + qualities: - id: 20 - qualities: - - id: 20 - name: Bluray-480p - source: bluray - resolution: 480 + name: Bluray-480p + source: bluray + resolution: 480 +- id: 21 + qualities: - id: 21 - qualities: - - id: 21 - name: Bluray-576p - source: bluray - resolution: 576 + name: Bluray-576p + source: bluray + resolution: 576 +- id: 4 + qualities: - id: 4 - qualities: - - id: 4 - name: HDTV-720p - source: tv - resolution: 720 + name: HDTV-720p + source: tv + resolution: 720 +- id: 5 + qualities: - id: 5 - qualities: - - id: 5 - name: WEBDL-720p - source: webdl - resolution: 720 + name: WEBDL-720p + source: webdl + resolution: 720 +- id: 14 + qualities: - id: 14 - qualities: - - id: 14 - name: WEBRip-720p - source: webrip - resolution: 720 + name: WEBRip-720p + source: webrip + resolution: 720 +- id: 6 + qualities: - id: 6 - qualities: - - id: 6 - name: Bluray-720p - source: bluray - resolution: 720 + name: Bluray-720p + source: bluray + resolution: 720 +- id: 9 + qualities: - id: 9 - qualities: - - id: 9 - name: HDTV-1080p - source: tv - resolution: 1080 + name: HDTV-1080p + source: tv + resolution: 1080 +- id: 3 + qualities: - id: 3 - qualities: - - id: 3 - name: WEBDL-1080p - source: webdl - resolution: 1080 + name: WEBDL-1080p + source: webdl + resolution: 1080 +- id: 15 + qualities: - id: 15 - qualities: - - id: 15 - name: WEBRip-1080p - source: webrip - resolution: 1080 + name: WEBRip-1080p + source: webrip + resolution: 1080 +- id: 7 + qualities: - id: 7 - qualities: - - id: 7 - name: Bluray-1080p - source: bluray - resolution: 1080 + name: Bluray-1080p + source: bluray + resolution: 1080 format_items: - - name: x264 - format: x264 - score: -200 - - name: x265 - format: x265 - score: 1000 - - name: 1080p - format: 1080p - score: 500 - - name: 720p - format: 720p - score: 200 +- name: x264 + format: x264 + score: -200 +- name: x265 + format: x265 + score: 1000 +- name: 1080p + format: 1080p + score: 500 +- name: 720p + format: 720p + score: 200 +language: + id: 1 + name: English diff --git a/config/quality_profile/BestQuality_2160p.yaml b/config/quality_profile/BestQuality_2160p.yaml index 3b50c9b..1320259 100644 --- a/config/quality_profile/BestQuality_2160p.yaml +++ b/config/quality_profile/BestQuality_2160p.yaml @@ -3,34 +3,37 @@ cutoff: 19 cutoff_format_score: 5000 min_format_score: 0 quality_groups: +- id: 18 + qualities: - id: 18 - qualities: - - id: 18 - name: WEBDL-2160p - source: webdl - resolution: 2160 + name: WEBDL-2160p + source: webdl + resolution: 2160 +- id: 17 + qualities: - id: 17 - qualities: - - id: 17 - name: WEBRip-2160p - source: webrip - resolution: 2160 + name: WEBRip-2160p + source: webrip + resolution: 2160 +- id: 19 + qualities: - id: 19 - qualities: - - id: 19 - name: Bluray-2160p - source: bluray - resolution: 2160 + name: Bluray-2160p + source: bluray + resolution: 2160 format_items: - - name: 2160p - format: 2160p - score: 2000 - - name: 1080p - format: 1080p - score: 500 - - name: x265 - format: x265 - score: 2000 - - name: x264 - format: x264 - score: -5000 +- name: 2160p + format: 2160p + score: 2000 +- name: 1080p + format: 1080p + score: 500 +- name: x265 + format: x265 + score: 2000 +- name: x264 + format: x264 + score: -5000 +language: + id: 1 + name: English diff --git a/config/quality_profile/DONT_USE_WEBDL.yaml b/config/quality_profile/DONT_USE_WEBDL.yaml index 2b0f24a..959a23d 100644 --- a/config/quality_profile/DONT_USE_WEBDL.yaml +++ b/config/quality_profile/DONT_USE_WEBDL.yaml @@ -3,30 +3,33 @@ cutoff: 1002 cutoff_format_score: 300 min_format_score: 300 quality_groups: - - id: 1002 - name: "WEB 1080p" - qualities: - - id: 3 - name: WEBDL-1080p - source: webdl - resolution: 1080 - - id: 15 - name: WEBRip-1080p - source: webrip - resolution: 1080 +- id: 1002 + name: WEB 1080p + qualities: + - id: 3 + name: WEBDL-1080p + source: webdl + resolution: 1080 + - id: 15 + name: WEBRip-1080p + source: webrip + resolution: 1080 format_items: - - name: 2160p - format: 2160p - score: -300 - - name: x264 - format: x264 - score: -200 - - name: x265 - format: x265 - score: -200 - - name: 1080p - format: 1080p - score: -200 - - name: 720p - format: 720p - score: 300 +- name: 2160p + format: 2160p + score: -300 +- name: x264 + format: x264 + score: -200 +- name: x265 + format: x265 + score: -200 +- name: 1080p + format: 1080p + score: -200 +- name: 720p + format: 720p + score: 300 +language: + id: 1 + name: English diff --git a/environments/radarr.service.consul/.terraform.lock.hcl b/environments/radarr.service.consul/.terraform.lock.hcl new file mode 100644 index 0000000..6f49c48 --- /dev/null +++ b/environments/radarr.service.consul/.terraform.lock.hcl @@ -0,0 +1,25 @@ +# This file is maintained automatically by "tofu init". +# Manual edits may be lost in future updates. + +provider "registry.opentofu.org/devopsarr/radarr" { + version = "2.3.5" + constraints = "2.3.5" + hashes = [ + "h1:wrU8A9nJHJ1W1VUSGC9O/J7AUJQOyY1OvKMDuL4W4Kw=", + "zh:18cb2579f9312aee8d17ffa938664f71c9376abea0a6da3d053ebdaef66a2f62", + "zh:19dbdff678f6f5b90da2f61ef4b1afed619a317474b344f9de15db35c57e2e47", + "zh:21af82e9cdd7b85f6a943655675bae1d330d225e6c4c683f9bbabfc938280228", + "zh:26bebd01c85d457dbe7e80978456695f00396ed830878b0151d495a4ce7ef4ba", + "zh:66eba536cf2b5de49c62386e65910347cb4deac6cdf9bec920a1090db6a8a5a4", + "zh:6905bbfbec2b7d67cab381c6491c018163e7cb410e55bfedc598ada378643c56", + "zh:78bdf398fe1db2c63c2ccc9da1b8fc27fb711ae831bef91e3ea198d7d684dc98", + "zh:890df766e9b839623b1f0437355032a3c006226a6c200cd911e15ee1a9014e9f", + "zh:8cff19564bf543894fbbca5c936f47fa9446724cefbaa2f63dedd79feb3ca52a", + "zh:94be12c4165d5fda164aff3e7b600e9dab40528563a0758dd198c9ace69437b6", + "zh:9c22c104248cb8022935df1674404bded46a4f4f54daf6ba96ee800316eb95b9", + "zh:a5d217038373d605531537ebaecae8ba136b8c7198a50c6a47c6932cb8485737", + "zh:c244be13b67eecbd395b123986343e77f168dc07eaaf888bc8206db2ba4a6cfc", + "zh:cee38aa1920f5d37ea56421b0ea57ebcefde87b0c57a61c5aa6476d4f185291a", + "zh:e95c3c4caad13cf1e4e37b721205d09564978d514f42ccb56d7ea94a498dad7e", + ] +} diff --git a/modules/radarr/main.tf b/modules/radarr/main.tf index f4c7583..58bf09f 100644 --- a/modules/radarr/main.tf +++ b/modules/radarr/main.tf @@ -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" { -- 2.47.3 From 267da8ffabda187d93db6f3bf9747745a4afe872 Mon Sep 17 00:00:00 2001 From: Ben Vincent Date: Sun, 28 Jun 2026 23:31:45 +1000 Subject: [PATCH 4/7] fix: change variable types from map(any) to any Allows heterogeneous quality profile and custom format structures without type unification errors. --- modules/radarr/variables.tf | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/radarr/variables.tf b/modules/radarr/variables.tf index 67d117a..1782c9f 100644 --- a/modules/radarr/variables.tf +++ b/modules/radarr/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 = {} } -- 2.47.3 From 482d6f5ee6360f5eadba8ff8cee27091da554965 Mon Sep 17 00:00:00 2001 From: Ben Vincent Date: Mon, 29 Jun 2026 23:26:13 +1000 Subject: [PATCH 5/7] fix: add versions.tf and fix tofu fmt for pre-commit Add required_providers block so tofu validate works in the module directory. Fix alignment from tofu fmt. --- modules/radarr/main.tf | 14 +++++++------- modules/radarr/versions.tf | 9 +++++++++ 2 files changed, 16 insertions(+), 7 deletions(-) create mode 100644 modules/radarr/versions.tf diff --git a/modules/radarr/main.tf b/modules/radarr/main.tf index 58bf09f..ebef332 100644 --- a/modules/radarr/main.tf +++ b/modules/radarr/main.tf @@ -73,14 +73,14 @@ resource "radarr_notification_emby" "this" { } 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) + 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 + tags = each.value.tags } resource "radarr_root_folder" "this" { diff --git a/modules/radarr/versions.tf b/modules/radarr/versions.tf new file mode 100644 index 0000000..a3e0c96 --- /dev/null +++ b/modules/radarr/versions.tf @@ -0,0 +1,9 @@ +terraform { + required_version = ">= 1.10" + required_providers { + radarr = { + source = "devopsarr/radarr" + version = ">= 2.3.5" + } + } +} -- 2.47.3 From c7ada6485119dcd358def770233688f5d74787f6 Mon Sep 17 00:00:00 2001 From: Ben Vincent Date: Mon, 29 Jun 2026 23:29:40 +1000 Subject: [PATCH 6/7] fix: remove versions.tf and exclude modules from validate/tflint The versions.tf conflicts with terragrunt's generated backend.tf which already has required_providers. Exclude modules/ from tofu-validate and tflint pre-commit hooks since they can't init without the full terragrunt context. --- .pre-commit-config.yaml | 2 ++ modules/radarr/versions.tf | 9 --------- 2 files changed, 2 insertions(+), 9 deletions(-) delete mode 100644 modules/radarr/versions.tf diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 646cd65..03d83e2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,7 +11,9 @@ repos: hooks: - id: tofu-fmt - id: tofu-validate + exclude: ^modules/ - id: tflint + exclude: ^modules/ - id: terragrunt-hcl-fmt - repo: https://github.com/adrienverge/yamllint.git rev: v1.37.1 diff --git a/modules/radarr/versions.tf b/modules/radarr/versions.tf deleted file mode 100644 index a3e0c96..0000000 --- a/modules/radarr/versions.tf +++ /dev/null @@ -1,9 +0,0 @@ -terraform { - required_version = ">= 1.10" - required_providers { - radarr = { - source = "devopsarr/radarr" - version = ">= 2.3.5" - } - } -} -- 2.47.3 From 63f6301a2e1bff18d6b2d59843349da26bf531c3 Mon Sep 17 00:00:00 2001 From: Ben Vincent Date: Mon, 29 Jun 2026 23:49:50 +1000 Subject: [PATCH 7/7] fix: align config with imported state for zero-drift plan --- config/download_client/NZBGet.yaml | 2 +- config/indexer/NZBgeek_Prowlarr.yaml | 1 + config/notification/Jellyfin.yaml | 1 + config/quality_profile/BestQuality_1080p.yaml | 144 +++++++++--------- config/quality_profile/BestQuality_2160p.yaml | 66 ++++---- config/quality_profile/DONT_USE_WEBDL.yaml | 56 +++---- modules/radarr/main.tf | 37 +++-- 7 files changed, 156 insertions(+), 151 deletions(-) diff --git a/config/download_client/NZBGet.yaml b/config/download_client/NZBGet.yaml index a79ea9f..3c25195 100644 --- a/config/download_client/NZBGet.yaml +++ b/config/download_client/NZBGet.yaml @@ -3,7 +3,7 @@ priority: 1 host: nzbget.service.consul port: 443 use_ssl: true -username: "" +username: "svc_nzbsubmit" password: "" movie_category: movies remove_completed_downloads: true diff --git a/config/indexer/NZBgeek_Prowlarr.yaml b/config/indexer/NZBgeek_Prowlarr.yaml index cc2c8ce..4c7ac8d 100644 --- a/config/indexer/NZBgeek_Prowlarr.yaml +++ b/config/indexer/NZBgeek_Prowlarr.yaml @@ -1,3 +1,4 @@ +name: "NZBgeek (Prowlarr)" enable_automatic_search: true enable_interactive_search: true enable_rss: true diff --git a/config/notification/Jellyfin.yaml b/config/notification/Jellyfin.yaml index e33a43d..956235f 100644 --- a/config/notification/Jellyfin.yaml +++ b/config/notification/Jellyfin.yaml @@ -1,3 +1,4 @@ +name: "Emby / Jellyfin" host: jellyfin.service.consul port: 443 use_ssl: true diff --git a/config/quality_profile/BestQuality_1080p.yaml b/config/quality_profile/BestQuality_1080p.yaml index d5173f6..a826826 100644 --- a/config/quality_profile/BestQuality_1080p.yaml +++ b/config/quality_profile/BestQuality_1080p.yaml @@ -2,80 +2,72 @@ upgrade_allowed: true cutoff: 7 cutoff_format_score: 5000 min_format_score: 0 -quality_groups: -- id: 20 - qualities: - - id: 20 - name: Bluray-480p - source: bluray - resolution: 480 -- id: 21 - qualities: - - id: 21 - name: Bluray-576p - source: bluray - resolution: 576 -- id: 4 - qualities: - - id: 4 - name: HDTV-720p - source: tv - resolution: 720 -- id: 5 - qualities: - - id: 5 - name: WEBDL-720p - source: webdl - resolution: 720 -- id: 14 - qualities: - - id: 14 - name: WEBRip-720p - source: webrip - resolution: 720 -- id: 6 - qualities: - - id: 6 - name: Bluray-720p - source: bluray - resolution: 720 -- id: 9 - qualities: - - id: 9 - name: HDTV-1080p - source: tv - resolution: 1080 -- id: 3 - qualities: - - id: 3 - name: WEBDL-1080p - source: webdl - resolution: 1080 -- id: 15 - qualities: - - id: 15 - name: WEBRip-1080p - source: webrip - resolution: 1080 -- id: 7 - qualities: - - id: 7 - name: Bluray-1080p - source: bluray - resolution: 1080 -format_items: -- name: x264 - format: x264 - score: -200 -- name: x265 - format: x265 - score: 1000 -- name: 1080p - format: 1080p - score: 500 -- name: 720p - format: 720p - score: 200 language: - id: 1 - name: English + id: -2 + name: Original +quality_groups: + - qualities: + - id: 7 + name: Bluray-1080p + source: bluray + resolution: 1080 + - id: 1002 + name: "WEB 1080p" + qualities: + - id: 3 + name: WEBDL-1080p + source: webdl + resolution: 1080 + - id: 15 + name: WEBRip-1080p + source: webrip + resolution: 1080 + - qualities: + - id: 9 + name: HDTV-1080p + source: tv + resolution: 1080 + - qualities: + - id: 6 + name: Bluray-720p + source: bluray + resolution: 720 + - id: 1001 + name: "WEB 720p" + qualities: + - id: 5 + name: WEBDL-720p + source: webdl + resolution: 720 + - id: 14 + name: WEBRip-720p + source: webrip + resolution: 720 + - qualities: + - id: 4 + name: HDTV-720p + source: tv + resolution: 720 + - qualities: + - id: 21 + name: Bluray-576p + source: bluray + resolution: 576 + - qualities: + - id: 20 + name: Bluray-480p + source: bluray + resolution: 480 +format_items: + - name: x264 + format: x264 + score: -200 + - name: x265 + format: x265 + score: 1000 + - name: 1080p + format: 1080p + score: 500 + - name: 720p + format: 720p + score: 200 diff --git a/config/quality_profile/BestQuality_2160p.yaml b/config/quality_profile/BestQuality_2160p.yaml index 1320259..994da93 100644 --- a/config/quality_profile/BestQuality_2160p.yaml +++ b/config/quality_profile/BestQuality_2160p.yaml @@ -2,38 +2,36 @@ upgrade_allowed: true cutoff: 19 cutoff_format_score: 5000 min_format_score: 0 -quality_groups: -- id: 18 - qualities: - - id: 18 - name: WEBDL-2160p - source: webdl - resolution: 2160 -- id: 17 - qualities: - - id: 17 - name: WEBRip-2160p - source: webrip - resolution: 2160 -- id: 19 - qualities: - - id: 19 - name: Bluray-2160p - source: bluray - resolution: 2160 -format_items: -- name: 2160p - format: 2160p - score: 2000 -- name: 1080p - format: 1080p - score: 500 -- name: x265 - format: x265 - score: 2000 -- name: x264 - format: x264 - score: -5000 language: - id: 1 - name: English + id: -2 + name: Original +quality_groups: + - qualities: + - id: 19 + name: Bluray-2160p + source: bluray + resolution: 2160 + - id: 1003 + name: "WEB 2160p" + qualities: + - id: 18 + name: WEBDL-2160p + source: webdl + resolution: 2160 + - id: 17 + name: WEBRip-2160p + source: webrip + resolution: 2160 +format_items: + - name: 2160p + format: 2160p + score: 2000 + - name: 1080p + format: 1080p + score: 500 + - name: x265 + format: x265 + score: 2000 + - name: x264 + format: x264 + score: -5000 diff --git a/config/quality_profile/DONT_USE_WEBDL.yaml b/config/quality_profile/DONT_USE_WEBDL.yaml index 959a23d..601988e 100644 --- a/config/quality_profile/DONT_USE_WEBDL.yaml +++ b/config/quality_profile/DONT_USE_WEBDL.yaml @@ -2,34 +2,34 @@ upgrade_allowed: true cutoff: 1002 cutoff_format_score: 300 min_format_score: 300 -quality_groups: -- id: 1002 - name: WEB 1080p - qualities: - - id: 3 - name: WEBDL-1080p - source: webdl - resolution: 1080 - - id: 15 - name: WEBRip-1080p - source: webrip - resolution: 1080 -format_items: -- name: 2160p - format: 2160p - score: -300 -- name: x264 - format: x264 - score: -200 -- name: x265 - format: x265 - score: -200 -- name: 1080p - format: 1080p - score: -200 -- name: 720p - format: 720p - score: 300 language: id: 1 name: English +quality_groups: + - id: 1002 + name: "WEB 1080p" + qualities: + - id: 3 + name: WEBDL-1080p + source: webdl + resolution: 1080 + - id: 15 + name: WEBRip-1080p + source: webrip + resolution: 1080 +format_items: + - name: 2160p + format: 2160p + score: -300 + - name: x264 + format: x264 + score: -200 + - name: x265 + format: x265 + score: -200 + - name: 1080p + format: 1080p + score: -200 + - name: 720p + format: 720p + score: 300 diff --git a/modules/radarr/main.tf b/modules/radarr/main.tf index ebef332..a6eaa4c 100644 --- a/modules/radarr/main.tf +++ b/modules/radarr/main.tf @@ -6,14 +6,15 @@ resource "radarr_custom_format" "this" { } resource "radarr_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 - language = each.value.language + 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) + min_upgrade_format_score = lookup(each.value, "min_upgrade_format_score", 0) + quality_groups = each.value.quality_groups + language = each.value.language format_items = [ for fi in lookup(each.value, "format_items", []) : { @@ -26,7 +27,7 @@ resource "radarr_quality_profile" "this" { resource "radarr_download_client_nzbget" "this" { for_each = var.download_clients - name = each.key + name = lookup(each.value, "name", each.key) enable = lookup(each.value, "enable", true) priority = lookup(each.value, "priority", 1) host = each.value.host @@ -37,11 +38,15 @@ resource "radarr_download_client_nzbget" "this" { movie_category = lookup(each.value, "movie_category", "") remove_completed_downloads = lookup(each.value, "remove_completed_downloads", true) remove_failed_downloads = lookup(each.value, "remove_failed_downloads", true) + + lifecycle { + ignore_changes = [password] + } } resource "radarr_indexer_newznab" "this" { for_each = var.indexers - name = each.key + name = lookup(each.value, "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) @@ -50,15 +55,19 @@ 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", []) + + lifecycle { + ignore_changes = [api_key] + } } resource "radarr_notification_emby" "this" { for_each = var.notifications - name = each.key + name = lookup(each.value, "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 + api_key = lookup(each.value, "api_key", "") notify = lookup(each.value, "notify", false) update_library = lookup(each.value, "update_library", true) @@ -70,6 +79,10 @@ resource "radarr_notification_emby" "this" { 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) + + lifecycle { + ignore_changes = [api_key] + } } resource "radarr_delay_profile" "this" { -- 2.47.3