back
terraform {
required_providers {
dns = ">= 3.1.0"
}
}
top
module "dns_mx_record_set" {
source = "./modules/dns/r/dns_mx_record_set"
# name - (optional) is a type of string
name = null
# ttl - (optional) is a type of number
ttl = null
# zone - (required) is a type of string
zone = null
mx = [{
exchange = null
preference = null
}]
}
top
variable "name" {
description = "(optional)"
type = string
default = null
}
variable "ttl" {
description = "(optional)"
type = number
default = null
}
variable "zone" {
description = "(required)"
type = string
}
variable "mx" {
description = "nested block: NestingSet, min items: 1, max items: 0"
type = set(object(
{
exchange = string
preference = number
}
))
}
top
resource "dns_mx_record_set" "this" {
# name - (optional) is a type of string
name = var.name
# ttl - (optional) is a type of number
ttl = var.ttl
# zone - (required) is a type of string
zone = var.zone
dynamic "mx" {
for_each = var.mx
content {
# exchange - (required) is a type of string
exchange = mx.value["exchange"]
# preference - (required) is a type of number
preference = mx.value["preference"]
}
}
}
top
output "id" {
description = "returns a string"
value = dns_mx_record_set.this.id
}
output "this" {
value = dns_mx_record_set.this
}
top