Skip to content

azurermPrivateDnsResolverForwardingRule

Manages a Private DNS Resolver Forwarding Rule.

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.*/
new azurerm.privateDnsResolverForwardingRule.PrivateDnsResolverForwardingRule(
  this,
  "example",
  {
    dns_forwarding_ruleset_id:
      "${azurerm_private_dns_resolver_dns_forwarding_ruleset.example.id}",
    domain_name: "onprem.local.",
    enabled: true,
    metadata: [
      {
        key: "value",
      },
    ],
    name: "example-rule",
    target_dns_servers: [
      {
        ip_address: "10.10.0.1",
        port: 53,
      },
    ],
  }
);
const azurermResourceGroupExample = new azurerm.resourceGroup.ResourceGroup(
  this,
  "example_1",
  {
    location: "west europe",
    name: "example-resources",
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermResourceGroupExample.overrideLogicalId("example");
const azurermVirtualNetworkExample = new azurerm.virtualNetwork.VirtualNetwork(
  this,
  "example_2",
  {
    address_space: ["10.0.0.0/16"],
    location: azurermResourceGroupExample.location,
    name: "example-vnet",
    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.*/
azurermVirtualNetworkExample.overrideLogicalId("example");
const azurermPrivateDnsResolverExample =
  new azurerm.privateDnsResolver.PrivateDnsResolver(this, "example_3", {
    location: azurermResourceGroupExample.location,
    name: "example-resolver",
    resource_group_name: azurermResourceGroupExample.name,
    virtual_network_id: azurermVirtualNetworkExample.id,
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermPrivateDnsResolverExample.overrideLogicalId("example");
const azurermSubnetExample = new azurerm.subnet.Subnet(this, "example_4", {
  address_prefixes: ["10.0.0.64/28"],
  delegation: [
    {
      name: "Microsoft.Network.dnsResolvers",
      service_delegation: [
        {
          actions: ["Microsoft.Network/virtualNetworks/subnets/join/action"],
          name: "Microsoft.Network/dnsResolvers",
        },
      ],
    },
  ],
  name: "outbounddns",
  resource_group_name: azurermResourceGroupExample.name,
  virtual_network_name: azurermVirtualNetworkExample.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.*/
azurermSubnetExample.overrideLogicalId("example");
const azurermPrivateDnsResolverOutboundEndpointExample =
  new azurerm.privateDnsResolverOutboundEndpoint.PrivateDnsResolverOutboundEndpoint(
    this,
    "example_5",
    {
      location: azurermPrivateDnsResolverExample.location,
      name: "example-endpoint",
      private_dns_resolver_id: azurermPrivateDnsResolverExample.id,
      subnet_id: azurermSubnetExample.id,
      tags: {
        key: "value",
      },
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermPrivateDnsResolverOutboundEndpointExample.overrideLogicalId("example");

Arguments Reference

The following arguments are supported:

  • name - (Required) Specifies the name which should be used for this Private DNS Resolver Forwarding Rule. Changing this forces a new Private DNS Resolver Forwarding Rule to be created.

  • dnsForwardingRulesetId - (Required) Specifies the ID of the Private DNS Resolver Forwarding Ruleset. Changing this forces a new Private DNS Resolver Forwarding Rule to be created.

  • domainName - (Required) Specifies the domain name for the Private DNS Resolver Forwarding Rule.

  • targetDnsServers - (Required) Can be specified multiple times to define multiple target DNS servers. Each targetDnsServers block as defined below.

  • enabled - (Optional) Specifies the state of the Private DNS Resolver Forwarding Rule. Defaults to true.

  • metadata - (Optional) Metadata attached to the Private DNS Resolver Forwarding Rule.


A targetDnsServers block supports the following:

  • ipAddress - (Required) DNS server IP address.

  • port - (Optional) DNS server port.

Attributes Reference

In addition to the Arguments listed above - the following Attributes are exported:

  • id - The ID of the Private DNS Resolver Forwarding Rule.

Timeouts

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

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

Import

Private DNS Resolver Forwarding Rules can be imported using the resourceId, e.g.

terraform import azurerm_private_dns_resolver_forwarding_rule.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup1/providers/Microsoft.Network/dnsForwardingRulesets/dnsForwardingRuleset1/forwardingRules/forwardingRule1