Skip to content

azurermDnsZone

Enables you to manage DNS zones within Azure DNS. These zones are hosted on Azure's name servers to which you can delegate the zone from the parent domain.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as azurerm from "./.gen/providers/azurerm";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: azurerm.
For a more precise conversion please use the --provider flag in convert.*/
const azurermResourceGroupExample = new azurerm.resourceGroup.ResourceGroup(
  this,
  "example",
  {
    location: "West Europe",
    name: "example-resources",
  }
);
new azurerm.dnsZone.DnsZone(this, "example-public", {
  name: "mydomain.com",
  resource_group_name: azurermResourceGroupExample.name,
});

Argument Reference

The following arguments are supported:

  • name - (Required) The name of the DNS Zone. Must be a valid domain name. Changing this forces a new resource to be created.

  • resourceGroupName - (Required) Specifies the resource group where the resource exists. Changing this forces a new resource to be created.

  • soaRecord - (Optional) An soaRecord block as defined below. Changing this forces a new resource to be created.

  • tags - (Optional) A mapping of tags to assign to the resource.


The soaRecord block supports:

  • email - (Required) The email contact for the SOA record.

  • hostName - (Required) The domain name of the authoritative name server for the SOA record.

  • expireTime - (Optional) The expire time for the SOA record. Defaults to 2419200.

  • minimumTtl - (Optional) The minimum Time To Live for the SOA record. By convention, it is used to determine the negative caching duration. Defaults to 300.

  • refreshTime - (Optional) The refresh time for the SOA record. Defaults to 3600.

  • retryTime - (Optional) The retry time for the SOA record. Defaults to 300.

  • serialNumber - (Optional) The serial number for the SOA record. Defaults to 1.

  • ttl - (Optional) The Time To Live of the SOA Record in seconds. Defaults to 3600.

  • tags - (Optional) A mapping of tags to assign to the Record Set.

Attributes Reference

The following attributes are exported:

  • id - The DNS Zone ID.

  • maxNumberOfRecordSets - (Optional) Maximum number of Records in the zone. Defaults to 1000.

  • numberOfRecordSets - (Optional) The number of records already in the zone.

  • nameServers - (Optional) A list of values that make up the NS record for the zone.

Timeouts

The timeouts block allows you to specify timeouts for certain actions:

  • create - (Defaults to 30 minutes) Used when creating the DNS Zone.

  • update - (Defaults to 30 minutes) Used when updating the DNS Zone.

  • read - (Defaults to 5 minutes) Used when retrieving the DNS Zone.

  • delete - (Defaults to 30 minutes) Used when deleting the DNS Zone.

Import

DNS Zones can be imported using the resourceId, e.g.

terraform import azurerm_dns_zone.zone1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Network/dnsZones/zone1