Skip to content

Commit

Permalink
azurerm_local_network_gateway - mark address_space argument optional (#…
Browse files Browse the repository at this point in the history
…10983)

To address issue #10891
  • Loading branch information
ms-henglu authored and tombuildsstuff committed Apr 6, 2021
1 parent c64cbad commit a95f225
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func resourceLocalNetworkGateway() *schema.Resource {

"address_space": {
Type: schema.TypeList,
Required: true,
Optional: true,
Elem: &schema.Schema{
Type: schema.TypeString,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,13 @@ func TestAccLocalNetworkGateway_updateAddressSpace(t *testing.T) {
r := LocalNetworkGatewayResource{}

data.ResourceTest(t, r, []resource.TestStep{
{
Config: r.noneAddressSpace(data),
Check: resource.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
),
},
data.ImportStep(),
{
Config: r.multipleAddressSpace(data),
Check: resource.ComposeTestCheckFunc(
Expand Down Expand Up @@ -369,6 +376,26 @@ resource "azurerm_local_network_gateway" "test" {
`, data.RandomInteger, data.Locations.Primary, data.RandomInteger)
}

func (LocalNetworkGatewayResource) noneAddressSpace(data acceptance.TestData) string {
return fmt.Sprintf(`
provider "azurerm" {
features {}
}
resource "azurerm_resource_group" "test" {
name = "acctest-%d"
location = "%s"
}
resource "azurerm_local_network_gateway" "test" {
name = "acctestlng-%d"
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
gateway_address = "127.0.0.1"
}
`, data.RandomInteger, data.Locations.Primary, data.RandomInteger)
}

func (LocalNetworkGatewayResource) multipleAddressSpace(data acceptance.TestData) string {
return fmt.Sprintf(`
provider "azurerm" {
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/local_network_gateway.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ The following arguments are supported:
* `location` - (Required) The location/region where the local network gateway is
created. Changing this forces a new resource to be created.

* `address_space` - (Required) The list of string CIDRs representing the
* `address_space` - (Optional) The list of string CIDRs representing the
address spaces the gateway exposes.

* `bgp_settings` - (Optional) A `bgp_settings` block as defined below containing the
Expand Down

0 comments on commit a95f225

Please sign in to comment.