Skip to content

azurermNatGateway

Manages a Azure NAT Gateway.

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: "nat-gateway-example-rg",
  }
);
const azurermNatGatewayExample = new azurerm.natGateway.NatGateway(
  this,
  "example_1",
  {
    idle_timeout_in_minutes: 10,
    location: azurermResourceGroupExample.location,
    name: "nat-Gateway",
    resource_group_name: azurermResourceGroupExample.name,
    sku_name: "Standard",
    zones: ["1"],
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermNatGatewayExample.overrideLogicalId("example");
const azurermPublicIpExample = new azurerm.publicIp.PublicIp(
  this,
  "example_2",
  {
    allocation_method: "Static",
    location: azurermResourceGroupExample.location,
    name: "nat-gateway-publicIP",
    resource_group_name: azurermResourceGroupExample.name,
    sku: "Standard",
    zones: ["1"],
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermPublicIpExample.overrideLogicalId("example");
const azurermPublicIpPrefixExample = new azurerm.publicIpPrefix.PublicIpPrefix(
  this,
  "example_3",
  {
    location: azurermResourceGroupExample.location,
    name: "nat-gateway-publicIPPrefix",
    prefix_length: 30,
    resource_group_name: azurermResourceGroupExample.name,
    zones: ["1"],
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermPublicIpPrefixExample.overrideLogicalId("example");

Argument Reference

The following arguments are supported:

  • name - (Required) Specifies the name of the NAT Gateway. Changing this forces a new resource to be created.

  • resourceGroupName - (Required) Specifies the name of the Resource Group in which the NAT Gateway should exist. Changing this forces a new resource to be created.

  • location - (Required) Specifies the supported Azure location where the NAT Gateway should exist. Changing this forces a new resource to be created.

  • idleTimeoutInMinutes - (Optional) The idle timeout which should be used in minutes. Defaults to 4.

  • skuName - (Optional) The SKU which should be used. At this time the only supported value is standard. Defaults to standard.

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

  • zones - (Optional) Specifies a list of Availability Zones in which this NAT Gateway should be located. Changing this forces a new NAT Gateway to be created.

Attributes Reference

The following attributes are exported:

  • id - The ID of the NAT Gateway.

  • resourceGuid - The resource GUID property of the NAT Gateway.

Timeouts

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

  • create - (Defaults to 60 minutes) Used when creating the NAT Gateway.
  • update - (Defaults to 60 minutes) Used when updating the NAT Gateway.
  • read - (Defaults to 5 minutes) Used when retrieving the NAT Gateway.
  • delete - (Defaults to 60 minutes) Used when deleting the NAT Gateway.

Import

NAT Gateway can be imported using the resourceId, e.g.

terraform import azurerm_nat_gateway.test /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Network/natGateways/gateway1