Update main.tf
Some checks failed
terraform validation / Terraform (push) Has been cancelled

This commit is contained in:
2025-11-04 17:01:22 +01:00
parent e4601c5f45
commit 576d0136a9

41
main.tf
View File

@@ -0,0 +1,41 @@
# =============================================================================
# VAULT DATA SOURCES
# =============================================================================
data "vault_generic_secret" "cloudflare" {
path = var.vault_cloudflare_path
}
# =============================================================================
# LOCALS
# =============================================================================
locals {
# Secrets Cloudflare depuis Vault
cloudflare_token = data.vault_generic_secret.cloudflare.data["api_token"]
cloudflare_zone_id = data.vault_generic_secret.cloudflare.data["zone_id"]
cloudflare_account_id = data.vault_generic_secret.cloudflare.data["account_id"]
cloudflare_email = data.vault_generic_secret.cloudflare.data["email"]
# Construction des ingress rules pour toutes les applications
ingress_rules = concat(
[
for app_name, app_config in var.applications : {
hostname = "${app_config.subdomain}.${var.cloudflare_zone}"
service = app_config.origin_url
origin_request = {
no_tls_verify = app_config.no_tls_verify
# Configuration Access si activée
access = app_config.access_enabled ? {
team_name = app_config.access_team_name
aud_tag = app_config.access_aud_tags
required = true
} : null
}
}
],
# Règle catch-all en dernier
[{
service = "http_status:404"
}]
)
}