From b2b7239968013ccd4cea8244e953eb7758bab5c7 Mon Sep 17 00:00:00 2001 From: Thomas Cardin <49320132+ThomasCardin@users.noreply.github.com> Date: Thu, 21 Nov 2024 11:42:10 -0500 Subject: [PATCH] zero_trsut --- terraform/modules/zero_trust_application/main.tf | 13 +++++++------ .../modules/zero_trust_application/variables.tf | 5 +++++ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/terraform/modules/zero_trust_application/main.tf b/terraform/modules/zero_trust_application/main.tf index 64d755a..c224092 100644 --- a/terraform/modules/zero_trust_application/main.tf +++ b/terraform/modules/zero_trust_application/main.tf @@ -1,8 +1,6 @@ -resource "cloudflare_access_policy" "policy" { - for_each = { for idx, name in var.names : idx => name } - +resource "cloudflare_access_policy" "github-app-policy" { zone_id = var.cloudflare_zone_id - name = "${each.value}-github-auth" + name = "github-auth" decision = "allow" include { @@ -11,9 +9,12 @@ resource "cloudflare_access_policy" "policy" { } resource "cloudflare_zero_trust_access_application" "app" { - for_each = { for idx, name in var.names : idx => name } + depends_on = [cloudflare_access_policy.github-app-policy] + for_each = { for idx, name in var.names : idx => name } + + account_id = var.cloudflare_api_key + zone_id = var.cloudflare_zone_id - zone_id = var.cloudflare_zone_id name = each.value domain = "${each.value}.ninebasetwo.net" type = "self_hosted" diff --git a/terraform/modules/zero_trust_application/variables.tf b/terraform/modules/zero_trust_application/variables.tf index c613e07..f732864 100644 --- a/terraform/modules/zero_trust_application/variables.tf +++ b/terraform/modules/zero_trust_application/variables.tf @@ -6,4 +6,9 @@ variable "names" { variable "cloudflare_zone_id" { description = "The zone ID for Cloudflare" type = string +} + +variable "cloudflare_api_key" { + description = "The API key for Cloudflare" + type = string } \ No newline at end of file