From 665e0ed29a03f86d41b73f1c13ef9ea2e9fbf195 Mon Sep 17 00:00:00 2001 From: Hiroto Kitazawa Date: Fri, 30 Oct 2026 23:10:34 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20Navidrome=20Music=E3=81=AB=E3=82=B5?= =?UTF-8?q?=E3=83=BC=E3=83=93=E3=82=B9=E3=83=88=E3=83=BC=E3=82=AF=E3=83=B3?= =?UTF-8?q?=E8=AA=8D=E8=A8=BC=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- access_application.tf | 4 ++++ access_policy.tf | 12 ++++++++++++ access_service_token.tf | 5 +++++ outputs.tf | 9 +++++++++ 4 files changed, 30 insertions(+) create mode 100644 access_service_token.tf diff --git a/access_application.tf b/access_application.tf index 8fca76b..e12d221 100644 --- a/access_application.tf +++ b/access_application.tf @@ -168,6 +168,10 @@ resource "cloudflare_zero_trust_access_application" "navidrome_music" { id = cloudflare_zero_trust_access_policy.admin.id precedence = 1 }, + { + id = cloudflare_zero_trust_access_policy.navidrome_music.id + precedence = 2 + }, ] auto_redirect_to_identity = false allow_authenticate_via_warp = false diff --git a/access_policy.tf b/access_policy.tf index d646499..19ed30e 100644 --- a/access_policy.tf +++ b/access_policy.tf @@ -9,3 +9,15 @@ resource "cloudflare_zero_trust_access_policy" "admin" { } }] } + +resource "cloudflare_zero_trust_access_policy" "navidrome_music" { + account_id = var.cloudflare_account_id + name = "Service Auth Navidrome Music" + decision = "non_identity" + + include = [{ + service_token = { + token_id = cloudflare_zero_trust_access_service_token.navidrome_music.id + } + }] +} diff --git a/access_service_token.tf b/access_service_token.tf new file mode 100644 index 0000000..4b14bc4 --- /dev/null +++ b/access_service_token.tf @@ -0,0 +1,5 @@ +resource "cloudflare_zero_trust_access_service_token" "navidrome_music" { + account_id = var.cloudflare_account_id + name = "Navidrome Music" + duration = "forever" +} diff --git a/outputs.tf b/outputs.tf index dff9d8e..7a831fd 100644 --- a/outputs.tf +++ b/outputs.tf @@ -24,3 +24,12 @@ output "tunnel_eq12_01_token" { value = data.cloudflare_zero_trust_tunnel_cloudflared_token.eq12_01 sensitive = true } + +output "navidrome_music_headers" { + description = "Navidrome Music の Access 認証に使用するカスタムヘッダー" + value = { + "CF-Access-Client-Id" = cloudflare_zero_trust_access_service_token.navidrome_music.client_id + "CF-Access-Client-Secret" = cloudflare_zero_trust_access_service_token.navidrome_music.client_secret + } + sensitive = true +}