
The module consolidates the management of DNS records in an existing or new public Azure DNS zone. Records are supplied as input parameters of the module to keep their management in a single code block. Supported record types: A
, AAAA
, CNAME
, MX
, NS
, TXT
.
Once you have a Corewide Solutions Portal account, this one-time action will use your browser session to retrieve credentials:
shellterraform login solutions.corewide.com
Initialize mandatory providers:
Copy and paste into your Terraform configuration and insert the variables:
hclmodule "tf_azure_dns" {
source = "solutions.corewide.com/azure/tf-azure-dns/azurerm"
version = "~> 1.0.0"
# specify module inputs here or try one of the examples below
...
}
Initialize the setup:
shellterraform init
Corewide DevOps team strictly follows Semantic Versioning
Specification
to
provide our clients with products that have predictable upgrades between versions. We
recommend
pinning
patch versions of our modules using pessimistic
constraint operator (~>
) to prevent breaking changes during upgrades.
To get new features during the upgrades (without breaking compatibility), use
~> 1.0
and run
terraform init -upgrade
For the safest setup, use strict pinning with version = "1.0.0"
All notable changes to this project are documented here.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
A
, AAAA
, CNAME
, MX
, NS
, TXT
record typesCreation of an A
record with an alias to the Azure public IP and creation of an MX
record for mail servers using the existing resource group and public hosted zone:
hclresource "azurerm_resource_group" "foo" {
name = "foo"
location = "eastus"
}
module "dns" {
source = "solutions.corewide.com/azure/tf-azure-dns/azurerm"
version = "~> 1.0"
resource_group_name = azurerm_resource_group.foo.name
create_zone = false
zone_name = "example.com"
records = {
app = {
type = "A"
alias = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Network/publicIPAddresses/myPublicIpAddress1"
}
mail = {
type = "MX"
ttl = 3600
value = [
"10 mailserver1.example.com",
"20 mailserver2.example.com",
]
}
}
}
Creation of a public hosted zone inside the existing resource group and pointing the root DNS record to a custom IP:
hclresource "azurerm_resource_group" "foo" {
name = "foo"
location = "eastus"
}
module "dns" {
source = "solutions.corewide.com/azure/tf-azure-dns/azurerm"
version = "~> 1.0"
resource_group_name = azurerm_resource_group.foo.name
create_zone = true
zone_name = "example.com"
records = {
"@" = {
type = "A"
ttl = 300
value = ["192.0.2.1"]
}
}
}
Variable | Description | Type | Default | Required | Sensitive |
---|---|---|---|---|---|
records[<key>] |
Name of the DNS record | string |
yes | no | |
resource_group_name |
The name of the existing resource group | string |
yes | no | |
zone_name |
The name of the DNS zone | string |
yes | no | |
create_zone |
Enable hosted zone creation | bool |
false |
no | no |
records |
Map of DNS record parameters: | map(object) |
{} |
no | no |
records[<key>].alias |
The Azure Resource ID of the target resource (for alias records) | string |
no | no | |
records[<key>].ttl |
Time to Live (TTL) of the record in seconds | number |
300 |
no | no |
records[<key>].type |
Record type (A , AAAA , CNAME , MX , NS , or TXT ) |
string |
yes | no | |
records[<key>].value |
A list of values for the record (required for non-alias records) | list(string) |
[] |
no | no |
Output | Description | Type | Sensitive |
---|---|---|---|
records |
Managed DNS records data | computed |
no |
zone |
DNS zone data | computed |
no |
Dependency | Version | Kind |
---|---|---|
terraform |
>= 1.3 |
CLI |
hashicorp/azurerm |
~> 4.2 |
provider |