mirror of
https://github.com/khuedoan/homelab.git
synced 2024-12-23 01:24:36 +07:00
32 lines
645 B
HCL
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
|
|
}
|
|
}
|
|
|