1
0
Fork 0
home-stack-kustomize/terraform/modules/do_dns/main.tf

31 lines
616 B
Terraform
Raw Normal View History

2023-02-17 19:43:19 +00:00
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
}