31 lines
616 B
HCL
31 lines
616 B
HCL
terraform {
|
|
required_providers {
|
|
digitalocean = {
|
|
source = "digitalocean/digitalocean"
|
|
version = "~> 2.0"
|
|
}
|
|
}
|
|
}
|
|
|
|
resource "digitalocean_domain" "root" {
|
|
name = var.root_domain_name
|
|
ip_address = var.root_domain_ip
|
|
}
|
|
|
|
resource "digitalocean_record" "mx_root" {
|
|
domain = digitalocean_domain.root.name
|
|
type = "MX"
|
|
name = "@"
|
|
priority = 0
|
|
value = "mail.${digitalocean_domain.root.name}."
|
|
}
|
|
|
|
resource "digitalocean_record" "records" {
|
|
for_each = var.records
|
|
|
|
domain = digitalocean_domain.root.name
|
|
type = each.value.type
|
|
name = each.key
|
|
value = each.value.value
|
|
}
|