Skip to content

Commit

Permalink
Resolving comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ArcturusZhang committed Dec 5, 2019
1 parent 9725cd1 commit dc970e5
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 5 deletions.
4 changes: 2 additions & 2 deletions azurerm/data_source_nat_gateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) },
Expand All @@ -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) },
Expand Down
1 change: 0 additions & 1 deletion azurerm/resource_arm_nat_gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ func resourceArmNatGateway() *schema.Resource {

"resource_guid": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ValidateFunc: validate.UUID,
},
Expand Down
2 changes: 1 addition & 1 deletion azurerm/resource_arm_nat_gateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
4 changes: 4 additions & 0 deletions website/azurerm.erb
Original file line number Diff line number Diff line change
Expand Up @@ -1688,6 +1688,10 @@
<a href="/docs/providers/azurerm/r/subnet.html">azurerm_subnet</a>
</li>

<li>
<a href="/docs/providers/azurerm/r/subnet_nat_gateway_association.html">azurerm_subnet_nat_gateway_association</a>
</li>

<li>
<a href="/docs/providers/azurerm/r/subnet_network_security_group_association.html">azurerm_subnet_network_security_group_association</a>
</li>
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/nat_gateway.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
69 changes: 69 additions & 0 deletions website/docs/r/subnet_nat_gateway_association.html.markdown
Original file line number Diff line number Diff line change
@@ -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
```

0 comments on commit dc970e5

Please sign in to comment.