Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

azurerm_virtual_network_gateway: making peering_address Computed+ForceNew #1040

Merged
merged 2 commits into from Mar 29, 2018

Conversation

tombuildsstuff
Copy link
Member

Adding a test covering spinning up an active-active VPN

Fixes #916

Before:

$ acctests azurerm TestAccAzureRMVirtualNetworkGateway_activeActive
=== RUN   TestAccAzureRMVirtualNetworkGateway_activeActive
--- FAIL: TestAccAzureRMVirtualNetworkGateway_activeActive (1956.69s)
	testing.go:513: Step 0 error: After applying this step, the plan was not empty:

		DIFF:

		UPDATE: azurerm_virtual_network_gateway.test
		  bgp_settings.0.peering_address: "10.0.1.4,10.0.1.5" => ""

		STATE:

		azurerm_public_ip.first:
		  ID = /subscriptions/c0a607b2-6372-4ef3-abdb-dbe52a7b56ba/resourceGroups/acctestRG-7126263343628930289/providers/Microsoft.Network/publicIPAddresses/acctestpip1-7126263343628930289
		  provider = provider.azurerm
		  location = eastus
		  name = acctestpip1-7126263343628930289
		  public_ip_address_allocation = dynamic
		  resource_group_name = acctestRG-7126263343628930289
		  sku = Basic
		  tags.% = 0
		  zones.# = 0

		  Dependencies:
		    azurerm_resource_group.test
		azurerm_public_ip.second:
		  ID = /subscriptions/c0a607b2-6372-4ef3-abdb-dbe52a7b56ba/resourceGroups/acctestRG-7126263343628930289/providers/Microsoft.Network/publicIPAddresses/acctestpip2-7126263343628930289
		  provider = provider.azurerm
		  location = eastus
		  name = acctestpip2-7126263343628930289
		  public_ip_address_allocation = dynamic
		  resource_group_name = acctestRG-7126263343628930289
		  sku = Basic
		  tags.% = 0
		  zones.# = 0

		  Dependencies:
		    azurerm_resource_group.test
		azurerm_resource_group.test:
		  ID = /subscriptions/c0a607b2-6372-4ef3-abdb-dbe52a7b56ba/resourceGroups/acctestRG-7126263343628930289
		  provider = provider.azurerm
		  location = eastus
		  name = acctestRG-7126263343628930289
		  tags.% = 0
		azurerm_subnet.test:
		  ID = /subscriptions/c0a607b2-6372-4ef3-abdb-dbe52a7b56ba/resourceGroups/acctestRG-7126263343628930289/providers/Microsoft.Network/virtualNetworks/acctestvn-7126263343628930289/subnets/GatewaySubnet
		  provider = provider.azurerm
		  address_prefix = 10.0.1.0/24
		  ip_configurations.# = 0
		  name = GatewaySubnet
		  resource_group_name = acctestRG-7126263343628930289
		  service_endpoints.# = 0
		  virtual_network_name = acctestvn-7126263343628930289

		  Dependencies:
		    azurerm_resource_group.test
		    azurerm_virtual_network.test
		azurerm_virtual_network.test:
		  ID = /subscriptions/c0a607b2-6372-4ef3-abdb-dbe52a7b56ba/resourceGroups/acctestRG-7126263343628930289/providers/Microsoft.Network/virtualNetworks/acctestvn-7126263343628930289
		  provider = provider.azurerm
		  address_space.# = 1
		  address_space.0 = 10.0.0.0/16
		  dns_servers.# = 0
		  location = eastus
		  name = acctestvn-7126263343628930289
		  resource_group_name = acctestRG-7126263343628930289
		  subnet.# = 0
		  tags.% = 0

		  Dependencies:
		    azurerm_resource_group.test
		azurerm_virtual_network_gateway.test:
		  ID = /subscriptions/c0a607b2-6372-4ef3-abdb-dbe52a7b56ba/resourceGroups/acctestRG-7126263343628930289/providers/Microsoft.Network/virtualNetworkGateways/acctestvng-7126263343628930289
		  provider = provider.azurerm
		  active_active = true
		  bgp_settings.# = 1
		  bgp_settings.0.asn = 65010
		  bgp_settings.0.peer_weight = 0
		  bgp_settings.0.peering_address = 10.0.1.4,10.0.1.5
		  enable_bgp = true
		  ip_configuration.# = 2
		  ip_configuration.0.name = gw-ip1
		  ip_configuration.0.private_ip_address_allocation = Dynamic
		  ip_configuration.0.public_ip_address_id = /subscriptions/c0a607b2-6372-4ef3-abdb-dbe52a7b56ba/resourceGroups/acctestRG-7126263343628930289/providers/Microsoft.Network/publicIPAddresses/acctestpip1-7126263343628930289
		  ip_configuration.0.subnet_id = /subscriptions/c0a607b2-6372-4ef3-abdb-dbe52a7b56ba/resourceGroups/acctestRG-7126263343628930289/providers/Microsoft.Network/virtualNetworks/acctestvn-7126263343628930289/subnets/GatewaySubnet
		  ip_configuration.1.name = gw-ip2
		  ip_configuration.1.private_ip_address_allocation = Dynamic
		  ip_configuration.1.public_ip_address_id = /subscriptions/c0a607b2-6372-4ef3-abdb-dbe52a7b56ba/resourceGroups/acctestRG-7126263343628930289/providers/Microsoft.Network/publicIPAddresses/acctestpip2-7126263343628930289
		  ip_configuration.1.subnet_id = /subscriptions/c0a607b2-6372-4ef3-abdb-dbe52a7b56ba/resourceGroups/acctestRG-7126263343628930289/providers/Microsoft.Network/virtualNetworks/acctestvn-7126263343628930289/subnets/GatewaySubnet
		  location = eastus
		  name = acctestvng-7126263343628930289
		  resource_group_name = acctestRG-7126263343628930289
		  sku = VpnGw1
		  tags.% = 0
		  type = Vpn
		  vpn_type = RouteBased

		  Dependencies:
		    azurerm_public_ip.first
		    azurerm_public_ip.second
		    azurerm_resource_group.test
		    azurerm_subnet.test
FAIL
exit status 1
FAIL	github.com/terraform-providers/terraform-provider-azurerm/azurerm	1956.721s

Now:

$ acctests azurerm TestAccAzureRMVirtualNetworkGateway_activeActive
=== RUN   TestAccAzureRMVirtualNetworkGateway_activeActive
--- PASS: TestAccAzureRMVirtualNetworkGateway_activeActive (1968.01s)
PASS
ok  	github.com/terraform-providers/terraform-provider-azurerm/azurerm	1968.050s

Adding a test covering spinning up an active-active VPN

Fixes #916

Before:
```
$ acctests azurerm TestAccAzureRMVirtualNetworkGateway_activeActive
=== RUN   TestAccAzureRMVirtualNetworkGateway_activeActive
--- FAIL: TestAccAzureRMVirtualNetworkGateway_activeActive (1956.69s)
	testing.go:513: Step 0 error: After applying this step, the plan was not empty:

		DIFF:

		UPDATE: azurerm_virtual_network_gateway.test
		  bgp_settings.0.peering_address: "10.0.1.4,10.0.1.5" => ""

		STATE:

		azurerm_public_ip.first:
		  ID = /subscriptions/c0a607b2-6372-4ef3-abdb-dbe52a7b56ba/resourceGroups/acctestRG-7126263343628930289/providers/Microsoft.Network/publicIPAddresses/acctestpip1-7126263343628930289
		  provider = provider.azurerm
		  location = eastus
		  name = acctestpip1-7126263343628930289
		  public_ip_address_allocation = dynamic
		  resource_group_name = acctestRG-7126263343628930289
		  sku = Basic
		  tags.% = 0
		  zones.# = 0

		  Dependencies:
		    azurerm_resource_group.test
		azurerm_public_ip.second:
		  ID = /subscriptions/c0a607b2-6372-4ef3-abdb-dbe52a7b56ba/resourceGroups/acctestRG-7126263343628930289/providers/Microsoft.Network/publicIPAddresses/acctestpip2-7126263343628930289
		  provider = provider.azurerm
		  location = eastus
		  name = acctestpip2-7126263343628930289
		  public_ip_address_allocation = dynamic
		  resource_group_name = acctestRG-7126263343628930289
		  sku = Basic
		  tags.% = 0
		  zones.# = 0

		  Dependencies:
		    azurerm_resource_group.test
		azurerm_resource_group.test:
		  ID = /subscriptions/c0a607b2-6372-4ef3-abdb-dbe52a7b56ba/resourceGroups/acctestRG-7126263343628930289
		  provider = provider.azurerm
		  location = eastus
		  name = acctestRG-7126263343628930289
		  tags.% = 0
		azurerm_subnet.test:
		  ID = /subscriptions/c0a607b2-6372-4ef3-abdb-dbe52a7b56ba/resourceGroups/acctestRG-7126263343628930289/providers/Microsoft.Network/virtualNetworks/acctestvn-7126263343628930289/subnets/GatewaySubnet
		  provider = provider.azurerm
		  address_prefix = 10.0.1.0/24
		  ip_configurations.# = 0
		  name = GatewaySubnet
		  resource_group_name = acctestRG-7126263343628930289
		  service_endpoints.# = 0
		  virtual_network_name = acctestvn-7126263343628930289

		  Dependencies:
		    azurerm_resource_group.test
		    azurerm_virtual_network.test
		azurerm_virtual_network.test:
		  ID = /subscriptions/c0a607b2-6372-4ef3-abdb-dbe52a7b56ba/resourceGroups/acctestRG-7126263343628930289/providers/Microsoft.Network/virtualNetworks/acctestvn-7126263343628930289
		  provider = provider.azurerm
		  address_space.# = 1
		  address_space.0 = 10.0.0.0/16
		  dns_servers.# = 0
		  location = eastus
		  name = acctestvn-7126263343628930289
		  resource_group_name = acctestRG-7126263343628930289
		  subnet.# = 0
		  tags.% = 0

		  Dependencies:
		    azurerm_resource_group.test
		azurerm_virtual_network_gateway.test:
		  ID = /subscriptions/c0a607b2-6372-4ef3-abdb-dbe52a7b56ba/resourceGroups/acctestRG-7126263343628930289/providers/Microsoft.Network/virtualNetworkGateways/acctestvng-7126263343628930289
		  provider = provider.azurerm
		  active_active = true
		  bgp_settings.# = 1
		  bgp_settings.0.asn = 65010
		  bgp_settings.0.peer_weight = 0
		  bgp_settings.0.peering_address = 10.0.1.4,10.0.1.5
		  enable_bgp = true
		  ip_configuration.# = 2
		  ip_configuration.0.name = gw-ip1
		  ip_configuration.0.private_ip_address_allocation = Dynamic
		  ip_configuration.0.public_ip_address_id = /subscriptions/c0a607b2-6372-4ef3-abdb-dbe52a7b56ba/resourceGroups/acctestRG-7126263343628930289/providers/Microsoft.Network/publicIPAddresses/acctestpip1-7126263343628930289
		  ip_configuration.0.subnet_id = /subscriptions/c0a607b2-6372-4ef3-abdb-dbe52a7b56ba/resourceGroups/acctestRG-7126263343628930289/providers/Microsoft.Network/virtualNetworks/acctestvn-7126263343628930289/subnets/GatewaySubnet
		  ip_configuration.1.name = gw-ip2
		  ip_configuration.1.private_ip_address_allocation = Dynamic
		  ip_configuration.1.public_ip_address_id = /subscriptions/c0a607b2-6372-4ef3-abdb-dbe52a7b56ba/resourceGroups/acctestRG-7126263343628930289/providers/Microsoft.Network/publicIPAddresses/acctestpip2-7126263343628930289
		  ip_configuration.1.subnet_id = /subscriptions/c0a607b2-6372-4ef3-abdb-dbe52a7b56ba/resourceGroups/acctestRG-7126263343628930289/providers/Microsoft.Network/virtualNetworks/acctestvn-7126263343628930289/subnets/GatewaySubnet
		  location = eastus
		  name = acctestvng-7126263343628930289
		  resource_group_name = acctestRG-7126263343628930289
		  sku = VpnGw1
		  tags.% = 0
		  type = Vpn
		  vpn_type = RouteBased

		  Dependencies:
		    azurerm_public_ip.first
		    azurerm_public_ip.second
		    azurerm_resource_group.test
		    azurerm_subnet.test
FAIL
exit status 1
FAIL	github.com/terraform-providers/terraform-provider-azurerm/azurerm	1956.721s
```

Now:

```
$ acctests azurerm TestAccAzureRMVirtualNetworkGateway_activeActive
=== RUN   TestAccAzureRMVirtualNetworkGateway_activeActive
--- PASS: TestAccAzureRMVirtualNetworkGateway_activeActive (1968.01s)
PASS
ok  	github.com/terraform-providers/terraform-provider-azurerm/azurerm	1968.050s
```
@tombuildsstuff tombuildsstuff added this to the 1.3.1 milestone Mar 28, 2018
@tombuildsstuff tombuildsstuff changed the title azurerm_virtual_network_gateway: making peering_address ForceNew azurerm_virtual_network_gateway: making peering_address Computed+ForceNew Mar 28, 2018
@@ -188,6 +188,7 @@ The `bgp_settings` block supports:

* `peer_weight` - (Optional) The weight added to routes which have been learned
through BGP peering. Valid values can be between `0` and `100`.
Changing this forces a new resource to be created.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be for peering_address instead of peer_weight

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good spot - fixed.

Copy link

@bill-rich bill-rich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tombuildsstuff
Copy link
Member Author

Tests pass:

screen shot 2018-03-28 at 21 22 01

@tombuildsstuff tombuildsstuff merged commit 772c246 into master Mar 29, 2018
@tombuildsstuff tombuildsstuff deleted the vng-peering-address branch March 29, 2018 13:42
tombuildsstuff added a commit that referenced this pull request Mar 29, 2018
@ghost
Copy link

ghost commented Mar 31, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!

@hashicorp hashicorp locked and limited conversation to collaborators Mar 31, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Issues with BGP peering_address for azurerm_virtual_network_gateway
2 participants