~damien/infrastructure

infrastructure/terraform/domain-address/main.tf -rw-r--r-- 731 bytes
b9a7a905Damien Radtke Re-introducing Packer into this 21 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
data "linode_domain" "d" {
  domain = var.domain
}

// Domains should only be applied in the default workspace to avoid clobbering DNS records in test deployments.

resource "linode_domain_record" "a" {
  for_each    = toset(terraform.workspace == "default" ? var.instances[*].ip_address : [])
  domain_id   = data.linode_domain.d.id
  name        = var.name
  record_type = "A"
  target      = each.value
}

resource "linode_domain_record" "aaaa" {
  for_each    = toset(terraform.workspace == "default" ? [for ip in var.instances[*].ipv6 : split("/", ip)[0]] : [])
  domain_id   = data.linode_domain.d.id
  name        = var.name
  record_type = "AAAA"
  target      = each.value
}

// vim: set expandtab shiftwidth=2 tabstop=2: