terraform/quickstart/101-dns_zone/main.tf

34 строки
838 B
Terraform
Исходник Постоянная ссылка Обычный вид История

2023-03-11 22:05:40 +03:00
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"
)
2023-03-11 22:05:40 +03:00
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
}