aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/digitalocean/domain/main.tf
blob: f1ebd63c5bd55e8a76ef8dc783fad40622ff1894 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
resource "digitalocean_domain" "this" {
  name = var.name
}

resource "digitalocean_project_resources" "domain" {
  project   = var.project_id
  resources = [digitalocean_domain.this.urn]
}

resource "digitalocean_record" "a" {
  type   = "A"
  domain = digitalocean_domain.this.id
  value  = var.ip_address
  name   = "@"
  ttl    = 3600
}

resource "digitalocean_record" "cname" {
  type   = "CNAME"
  domain = digitalocean_domain.this.id
  value  = "@"
  name   = each.value

  for_each = toset(var.aliases)
}