Skip to content

azurermPrivateDnsZone

Enables you to manage Private DNS zones within Azure DNS. These zones are hosted on Azure's name servers.

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",
  }
);
const azurermPrivateDnsZoneExample = new azurerm.privateDnsZone.PrivateDnsZone(
  this,
  "example_1",
  {
    name: "mydomain.com",
    resource_group_name: azurermResourceGroupExample.name,
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermPrivateDnsZoneExample.overrideLogicalId("example");

Argument Reference

The following arguments are supported:

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

-> NOTE: If you are going to be using the Private DNS Zone with a Private Endpoint the name of the Private DNS Zone must follow the Private DNS Zone name schema in the product documentation in order for the two resources to be connected successfully.

  • 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.

  • 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 10.

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

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

  • 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 Private DNS Zone ID.
  • soaRecord - A soaRecord block as defined below.
  • numberOfRecordSets - The current number of record sets in this Private DNS zone.
  • maxNumberOfRecordSets - The maximum number of record sets that can be created in this Private DNS zone.
  • maxNumberOfVirtualNetworkLinks - The maximum number of virtual networks that can be linked to this Private DNS zone.
  • maxNumberOfVirtualNetworkLinksWithRegistration - The maximum number of virtual networks that can be linked to this Private DNS zone with registration enabled.

A soaRecord block exports the following:

  • fqdn - The fully qualified domain name of the Record Set.

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

  • serialNumber - The serial number for the SOA record.

Timeouts

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

  • create - (Defaults to 30 minutes) Used when creating the Private DNS Zone.
  • update - (Defaults to 30 minutes) Used when updating the Private DNS Zone.
  • read - (Defaults to 5 minutes) Used when retrieving the Private DNS Zone.
  • delete - (Defaults to 30 minutes) Used when deleting the Private DNS Zone.

Import

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

terraform import azurerm_private_dns_zone.zone1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Network/privateDnsZones/zone1