From f484c322b1e1e8c2c0fb7d7f10e80ec9afc400e5 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Fri, 4 Aug 2023 15:50:41 +0200 Subject: digitalocean/domain: support CNAME aliases --- digitalocean/domain/main.tf | 9 +++++++++ digitalocean/domain/variables.tf | 5 +++++ 2 files changed, 14 insertions(+) diff --git a/digitalocean/domain/main.tf b/digitalocean/domain/main.tf index a5980ea..f1ebd63 100644 --- a/digitalocean/domain/main.tf +++ b/digitalocean/domain/main.tf @@ -14,3 +14,12 @@ resource "digitalocean_record" "a" { name = "@" ttl = 3600 } + +resource "digitalocean_record" "cname" { + type = "CNAME" + domain = digitalocean_domain.this.id + value = "@" + name = each.value + + for_each = toset(var.aliases) +} diff --git a/digitalocean/domain/variables.tf b/digitalocean/domain/variables.tf index bcff122..0d49ec4 100644 --- a/digitalocean/domain/variables.tf +++ b/digitalocean/domain/variables.tf @@ -8,3 +8,8 @@ variable "name" { variable "ip_address" { type = string } + +variable "aliases" { + type = list(string) + default = [] +} -- cgit v1.2.3