terraform/quickstart/101-dns_zone/main.tf

34 строки
838 B
HCL

resource "random_pet" "rg_name" {
prefix = var.resource_group_name_prefix
}
resource "azurerm_resource_group" "rg" {
name = random_pet.rg_name.id
location = var.resource_group_location
}
resource "random_string" "azurerm_dns_zone_name" {
length = 13
lower = true
numeric = false
special = false
upper = false
}
resource "azurerm_dns_zone" "zone" {
name = (
var.dns_zone_name != null ?
var.dns_zone_name :
"www.${random_string.azurerm_dns_zone_name.result}.azurequickstart.org"
)
resource_group_name = azurerm_resource_group.rg.name
}
resource "azurerm_dns_a_record" "record" {
name = "www"
resource_group_name = azurerm_resource_group.rg.name
zone_name = azurerm_dns_zone.zone.name
ttl = var.dns_ttl
records = var.dns_records
}