diff --git a/azurerm/data_source_nat_gateway_test.go b/azurerm/data_source_nat_gateway_test.go index 96eb14117228..3b5c23397565 100644 --- a/azurerm/data_source_nat_gateway_test.go +++ b/azurerm/data_source_nat_gateway_test.go @@ -11,7 +11,7 @@ import ( func TestAccDataSourceAzureRMNatGateway_basic(t *testing.T) { ri := tf.AccRandTimeInt() // It is hard-coded because this resource currently only available in eastus2. - location := "eastus2" + location := testAltLocation() resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, @@ -29,7 +29,7 @@ func TestAccDataSourceAzureRMNatGateway_complete(t *testing.T) { dataSourceName := "data.azurerm_nat_gateway.test" ri := tf.AccRandTimeInt() // It is hard-coded because this resource currently only available in eastus2. - location := "eastus2" + location := testAltLocation() resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, diff --git a/azurerm/resource_arm_nat_gateway.go b/azurerm/resource_arm_nat_gateway.go index ccc01fb07850..622225e5df8e 100644 --- a/azurerm/resource_arm_nat_gateway.go +++ b/azurerm/resource_arm_nat_gateway.go @@ -69,7 +69,6 @@ func resourceArmNatGateway() *schema.Resource { "resource_guid": { Type: schema.TypeString, - Optional: true, Computed: true, ValidateFunc: validate.UUID, }, diff --git a/azurerm/resource_arm_nat_gateway_test.go b/azurerm/resource_arm_nat_gateway_test.go index f7ea8ad49efd..e6c60e9dc45e 100644 --- a/azurerm/resource_arm_nat_gateway_test.go +++ b/azurerm/resource_arm_nat_gateway_test.go @@ -170,7 +170,7 @@ resource "azurerm_nat_gateway" "test" { func testAccAzureRMNatGateway_complete(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG-%d" + name = "acctestRG-network-%d" location = "%s" } diff --git a/website/azurerm.erb b/website/azurerm.erb index 8be936675f43..33389c6dd345 100644 --- a/website/azurerm.erb +++ b/website/azurerm.erb @@ -1688,6 +1688,10 @@ azurerm_subnet +
  • + azurerm_subnet_nat_gateway_association +
  • +
  • azurerm_subnet_network_security_group_association
  • diff --git a/website/docs/r/nat_gateway.html.markdown b/website/docs/r/nat_gateway.html.markdown index bc5727a25bd4..e9f9e72044e5 100644 --- a/website/docs/r/nat_gateway.html.markdown +++ b/website/docs/r/nat_gateway.html.markdown @@ -10,7 +10,7 @@ description: |- Manages an Azure NAT Gateway instance. --> **NOTE:** The Azure NAT Gateway service is currently in private preview. Your subscription must be on the NAT Gateway private preview whitelist for this resource to be provisioned correctly. If you attempt to provision this resource and receive an `InvalidResourceType` error that means that your subscription is not part of the NAT Gateway private preview whitelist and you will not be able to use this resource. The NAT Gateway private preview service is currently only available in the `East US 2` and `West Central US` regions. +-> **NOTE:** The Azure NAT Gateway service is currently in private preview. Your subscription must be on the NAT Gateway private preview whitelist for this resource to be provisioned correctly. If you attempt to provision this resource and receive an `InvalidResourceType` error that means that your subscription is not part of the NAT Gateway private preview whitelist and you will not be able to use this resource. The NAT Gateway private preview service is currently only available in the `East US 2` and `West Central US` regions. Since the NAT Gateway is currently in preview, breaking changes can possibly happen. If you want to contribute or get any concern, please contact azure support. ## Example Usage diff --git a/website/docs/r/subnet_nat_gateway_association.html.markdown b/website/docs/r/subnet_nat_gateway_association.html.markdown new file mode 100644 index 000000000000..05d95f4d846c --- /dev/null +++ b/website/docs/r/subnet_nat_gateway_association.html.markdown @@ -0,0 +1,69 @@ +--- +subcategory: "" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_subnet_nat_gateway_association" +sidebar_current: "docs-azurerm-resource-network-subnet-nat-gateway-association" +description: |- + Associates a [NAT Gateway](nat_gateway.html) with a [Subnet](subnet.html) within a [Virtual Network](virtual_network.html). + +--- + +# azurerm_subnet_route_table_association + +Associates a [NAT Gateway](nat_gateway.html) with a [Subnet](subnet.html) within a [Virtual Network](virtual_network.html). + +## Example Usage + +```hcl +resource "azurerm_resource_group" "example" { + name = "acctestRG-network-%d" + location = "East US 2" +} + +resource "azurerm_virtual_network" "example" { + name = "example-network" + address_space = ["10.0.0.0/16"] + location = "${azurerm_resource_group.example.location}" + resource_group_name = "${azurerm_resource_group.example.name}" +} + +resource "azurerm_subnet" "example" { + name = "example-subnet" + resource_group_name = "${azurerm_resource_group.example.name}" + virtual_network_name = "${azurerm_virtual_network.example.name}" + address_prefix = "10.0.2.0/24" +} + +resource "azurerm_nat_gateway" "example" { + name = "example-natgateway" + location = "${azurerm_resource_group.example.location}" + resource_group_name = "${azurerm_resource_group.example.name}" +} + +resource "azurerm_subnet_nat_gateway_association" "example" { + subnet_id = "${azurerm_subnet.example.id}" + nat_gateway_id = "${azurerm_nat_gateway.example.id}" +} +``` + +## Argument Reference + +The following arguments are supported: + +* `nat_gateway_id` - (Required) The ID of the NAT Gateway which should be associated with the Subnet. Changing this forces a new resource to be created. + +* `subnet_id` - (Required) The ID of the Subnet. Changing this forces a new resource to be created. + +## Attributes Reference + +The following attributes are exported: + +* `id` - The ID of the Subnet. + +## Import + +Subnet Route Table Associations can be imported using the `resource id` of the Subnet, e.g. + +```shell +terraform import azurerm_subnet_nat_gateway_association.association1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Network/virtualNetworks/myvnet1/subnets/mysubnet1 +```