Template:Cloudflare zones django example

From wikieduonline
Revision as of 11:27, 8 March 2024 by Welcome (talk | contribs) (Created page with " data "cloudflare_zones" "zones" { filter {} } locals { zones = {for zone in data.cloudflare_zones.zones.zones : zone.name => zone.id} } resource "cloudflare_rec...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
data "cloudflare_zones" "zones" {
  filter {}
}

locals {
  zones = {for zone in data.cloudflare_zones.zones.zones : zone.name => zone.id}
}

resource "cloudflare_record" "record" {
  for_each = var.records
  name     = each.key
  type     = each.value.type
  value    = each.value.value
  proxied  = each.value.proxied
  zone_id  = lookup(local.zones, regex(".*?([^.]+\\.[^.]+)$", each.key)[0])
  lifecycle {
    ignore_changes = [zone_id]
  }
}

Advertising: