khuedoan-homelab/external/external_dns.tf

32 lines
645 B
HCL

resource "cloudflare_api_token" "external_dns" {
name = "homelab_external_dns"
policy {
permission_groups = [
data.cloudflare_api_token_permission_groups.all.permissions["Zone Read"],
data.cloudflare_api_token_permission_groups.all.permissions["DNS Write"]
]
resources = {
"com.cloudflare.api.account.zone.*" = "*"
}
}
condition {
request_ip {
in = local.public_ips
}
}
}
resource "kubernetes_secret" "external_dns_token" {
metadata {
name = "cloudflare-api-token"
namespace = "external-dns"
}
data = {
"value" = cloudflare_api_token.external_dns.value
}
}