Manages the association between a NAT Gateway and a Public IP.
resource "azurerm_resource_group" "example" {
name = "example-resources"
location = "West Europe"
}
resource "azurerm_public_ip" "example" {
name = "example-PIP"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
allocation_method = "Static"
sku = "Standard"
}
resource "azurerm_nat_gateway" "example" {
name = "example-NatGateway"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
sku_name = "Standard"
}
resource "azurerm_nat_gateway_public_ip_association" "example" {
nat_gateway_id = azurerm_nat_gateway.example.id
public_ip_address_id = azurerm_public_ip.example.id
}
The following arguments are supported:
nat_gateway_id
- (Required) The ID of the NAT Gateway. Changing this forces a new resource to be created.
public_ip_address_id
- (Required) The ID of the Public IP which this NAT Gateway which should be connected to. Changing this forces a new resource to be created.
In addition to the Arguments listed above - the following Attributes are exported:
id
- The (Terraform specific) ID of the Association between the NAT Gateway and the Public IP.The timeouts
block allows you to specify timeouts for certain actions:
create
- (Defaults to 30 minutes) Used when creating the association between the NAT Gateway and the Public IP.read
- (Defaults to 5 minutes) Used when retrieving the association between the NAT Gateway and the Public IP.delete
- (Defaults to 30 minutes) Used when deleting the association between the NAT Gateway and the Public IP.Associations between NAT Gateway and Public IP Addresses can be imported using the resource id
, e.g.
terraform import azurerm_nat_gateway_public_ip_association.example "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Network/natGateways/gateway1|/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Network/publicIPAddresses/myPublicIpAddress1"