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

Wait for network provisioning state when creating or updating resources #13294

Merged
merged 5 commits into from
Sep 14, 2021

Conversation

owenfarrell
Copy link
Contributor

@owenfarrell owenfarrell commented Sep 9, 2021

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for pull request followers and do not help prioritize the request

Summary

This pull request verifies the state of virtual networks and subnets returns to Successful after making modifications that push them in to an Updating state. As a result, this ensures that the associated lock held on each resource is not released until that resource is actually ready to support another operation initiated through the API (whatever that may be).

Related (maybe): #3780
Related: #13105
Related (maybe): #13258

Output from acceptance testing:

$ make acctests SERVICE='network' TESTARGS='-run="TestAcc(VirtualNetwork|Subnet|VirtualHubConnection)_"' TESTTIMEOUT='120m'
==> Checking that code complies with gofmt requirements...
==> Checking that Custom Timeouts are used...
==> Checking that acceptance test packages are used...
TF_ACC=1 go test -v ./internal/services/network -run="TestAcc(VirtualNetwork|Subnet|VirtualHubConnection)_" -timeout 120m -ldflags="-X=github.com/hashicorp/terraform-provider-azurerm/version.ProviderVersion=acc"
=== RUN   TestAccSubnet_basic
=== PAUSE TestAccSubnet_basic
=== RUN   TestAccSubnet_basic_addressPrefixes
=== PAUSE TestAccSubnet_basic_addressPrefixes
=== RUN   TestAccSubnet_complete_addressPrefixes
=== PAUSE TestAccSubnet_complete_addressPrefixes
=== RUN   TestAccSubnet_update_addressPrefixes
=== PAUSE TestAccSubnet_update_addressPrefixes
=== RUN   TestAccSubnet_requiresImport
=== PAUSE TestAccSubnet_requiresImport
=== RUN   TestAccSubnet_disappears
=== PAUSE TestAccSubnet_disappears
=== RUN   TestAccSubnet_delegation
=== PAUSE TestAccSubnet_delegation
=== RUN   TestAccSubnet_enforcePrivateLinkEndpointNetworkPolicies
=== PAUSE TestAccSubnet_enforcePrivateLinkEndpointNetworkPolicies
=== RUN   TestAccSubnet_enforcePrivateLinkServiceNetworkPolicies
=== PAUSE TestAccSubnet_enforcePrivateLinkServiceNetworkPolicies
=== RUN   TestAccSubnet_serviceEndpoints
=== PAUSE TestAccSubnet_serviceEndpoints
=== RUN   TestAccSubnet_serviceEndpointPolicy
=== PAUSE TestAccSubnet_serviceEndpointPolicy
=== RUN   TestAccSubnet_updateAddressPrefix
=== PAUSE TestAccSubnet_updateAddressPrefix
=== RUN   TestAccVirtualHubConnection_basic
=== PAUSE TestAccVirtualHubConnection_basic
=== RUN   TestAccVirtualHubConnection_requiresImport
=== PAUSE TestAccVirtualHubConnection_requiresImport
=== RUN   TestAccVirtualHubConnection_complete
=== PAUSE TestAccVirtualHubConnection_complete
=== RUN   TestAccVirtualHubConnection_update
=== PAUSE TestAccVirtualHubConnection_update
=== RUN   TestAccVirtualHubConnection_enableInternetSecurity
=== PAUSE TestAccVirtualHubConnection_enableInternetSecurity
=== RUN   TestAccVirtualHubConnection_recreateWithSameConnectionName
=== PAUSE TestAccVirtualHubConnection_recreateWithSameConnectionName
=== RUN   TestAccVirtualHubConnection_removeRoutingConfiguration
=== PAUSE TestAccVirtualHubConnection_removeRoutingConfiguration
=== RUN   TestAccVirtualHubConnection_removePropagatedRouteTable
=== PAUSE TestAccVirtualHubConnection_removePropagatedRouteTable
=== RUN   TestAccVirtualHubConnection_removeVnetStaticRoute
=== PAUSE TestAccVirtualHubConnection_removeVnetStaticRoute
=== RUN   TestAccVirtualHubConnection_requiresLocking
=== PAUSE TestAccVirtualHubConnection_requiresLocking
=== RUN   TestAccVirtualHubConnection_updateRoutingConfiguration
=== PAUSE TestAccVirtualHubConnection_updateRoutingConfiguration
=== RUN   TestAccVirtualNetwork_basic
=== PAUSE TestAccVirtualNetwork_basic
=== RUN   TestAccVirtualNetwork_complete
=== PAUSE TestAccVirtualNetwork_complete
=== RUN   TestAccVirtualNetwork_basicUpdated
=== PAUSE TestAccVirtualNetwork_basicUpdated
=== RUN   TestAccVirtualNetwork_requiresImport
=== PAUSE TestAccVirtualNetwork_requiresImport
=== RUN   TestAccVirtualNetwork_ddosProtectionPlan
=== PAUSE TestAccVirtualNetwork_ddosProtectionPlan
=== RUN   TestAccVirtualNetwork_disappears
=== PAUSE TestAccVirtualNetwork_disappears
=== RUN   TestAccVirtualNetwork_withTags
=== PAUSE TestAccVirtualNetwork_withTags
=== RUN   TestAccVirtualNetwork_deleteSubnet
=== PAUSE TestAccVirtualNetwork_deleteSubnet
=== RUN   TestAccVirtualNetwork_bgpCommunity
=== PAUSE TestAccVirtualNetwork_bgpCommunity
=== CONT  TestAccSubnet_basic
=== CONT  TestAccVirtualHubConnection_enableInternetSecurity
=== CONT  TestAccSubnet_enforcePrivateLinkServiceNetworkPolicies
=== CONT  TestAccVirtualHubConnection_update
=== CONT  TestAccVirtualHubConnection_complete
=== CONT  TestAccVirtualHubConnection_requiresImport
=== CONT  TestAccVirtualHubConnection_basic
=== CONT  TestAccSubnet_updateAddressPrefix
--- PASS: TestAccSubnet_basic (155.68s)
=== CONT  TestAccSubnet_serviceEndpointPolicy
--- PASS: TestAccSubnet_updateAddressPrefix (229.75s)
=== CONT  TestAccSubnet_serviceEndpoints
--- PASS: TestAccSubnet_enforcePrivateLinkServiceNetworkPolicies (299.07s)
=== CONT  TestAccVirtualNetwork_complete
--- PASS: TestAccVirtualNetwork_complete (122.07s)
=== CONT  TestAccVirtualNetwork_bgpCommunity
--- PASS: TestAccSubnet_serviceEndpointPolicy (271.80s)
=== CONT  TestAccVirtualNetwork_deleteSubnet
--- PASS: TestAccSubnet_serviceEndpoints (358.93s)
=== CONT  TestAccVirtualNetwork_withTags
--- PASS: TestAccVirtualNetwork_deleteSubnet (194.53s)
=== CONT  TestAccVirtualNetwork_disappears
--- PASS: TestAccVirtualNetwork_bgpCommunity (276.93s)
=== CONT  TestAccVirtualNetwork_ddosProtectionPlan
--- PASS: TestAccVirtualNetwork_disappears (108.43s)
=== CONT  TestAccVirtualNetwork_requiresImport
--- PASS: TestAccVirtualNetwork_withTags (169.14s)
=== CONT  TestAccSubnet_requiresImport
=== CONT  TestAccSubnet_enforcePrivateLinkEndpointNetworkPolicies
--- PASS: TestAccVirtualNetwork_requiresImport (194.22s)
--- PASS: TestAccVirtualNetwork_ddosProtectionPlan (239.51s)
=== CONT  TestAccSubnet_delegation
--- PASS: TestAccSubnet_requiresImport (213.89s)
=== CONT  TestAccSubnet_disappears
--- PASS: TestAccSubnet_disappears (123.26s)
=== CONT  TestAccVirtualHubConnection_removeVnetStaticRoute
--- PASS: TestAccSubnet_enforcePrivateLinkEndpointNetworkPolicies (300.65s)
=== CONT  TestAccVirtualNetwork_basic
--- PASS: TestAccSubnet_delegation (444.16s)
=== CONT  TestAccVirtualHubConnection_updateRoutingConfiguration
--- PASS: TestAccVirtualNetwork_basic (182.92s)
=== CONT  TestAccVirtualHubConnection_requiresLocking
--- PASS: TestAccVirtualHubConnection_basic (2062.10s)
=== CONT  TestAccSubnet_complete_addressPrefixes
--- PASS: TestAccVirtualHubConnection_requiresImport (2146.35s)
=== CONT  TestAccSubnet_update_addressPrefixes
--- PASS: TestAccSubnet_complete_addressPrefixes (197.01s)
=== CONT  TestAccVirtualNetwork_basicUpdated
=== CONT  TestAccSubnet_basic_addressPrefixes
--- PASS: TestAccVirtualHubConnection_complete (2277.51s)
--- PASS: TestAccVirtualHubConnection_enableInternetSecurity (2363.56s)
=== CONT  TestAccVirtualHubConnection_removeRoutingConfiguration
--- PASS: TestAccSubnet_basic_addressPrefixes (141.19s)
=== CONT  TestAccVirtualHubConnection_removePropagatedRouteTable
--- PASS: TestAccVirtualNetwork_basicUpdated (204.44s)
=== CONT  TestAccVirtualHubConnection_recreateWithSameConnectionName
--- PASS: TestAccSubnet_update_addressPrefixes (356.92s)
--- PASS: TestAccVirtualHubConnection_update (2870.52s)
--- PASS: TestAccVirtualHubConnection_removeVnetStaticRoute (2221.92s)
--- PASS: TestAccVirtualHubConnection_updateRoutingConfiguration (2125.62s)
--- PASS: TestAccVirtualHubConnection_requiresLocking (2104.49s)
--- PASS: TestAccVirtualHubConnection_removePropagatedRouteTable (2248.30s)
--- PASS: TestAccVirtualHubConnection_removeRoutingConfiguration (2317.69s)
--- PASS: TestAccVirtualHubConnection_recreateWithSameConnectionName (2559.00s)
PASS
ok      github.com/hashicorp/terraform-provider-azurerm/internal/services/network       5025.064s

Co-authored-by: stephybun <[email protected]>
Signed-off-by: Owen Farrell <[email protected]>
@owenfarrell
Copy link
Contributor Author

@stephybun - Thanks for the review! I've incorporated the changes you requested in cc9c365.

One thing that I didn't call out above that is worth mentioning: I made the refresh functions for both subnets and virtual networks accessible from other packages to support the other impacted resources (listed in #13105). I realize that might look a little weird/off now, but it was an intentional setup for the longer play.

@stephybun
Copy link
Member

@owenfarrell thanks for the clarification 🙂, that did catch my attention during the review, but after reading the discussions in the linked issues I agree that those functions should be accessible from other affected resources.

Thanks for the PR and for fixing the suggestions, this LGTM 🚀

@stephybun stephybun merged commit 40cfe95 into hashicorp:main Sep 14, 2021
@stephybun stephybun added this to the v2.77.0 milestone Sep 14, 2021
stephybun added a commit that referenced this pull request Sep 14, 2021
@owenfarrell owenfarrell deleted the vnet-provisioning-state branch September 14, 2021 14:56
@github-actions
Copy link

This functionality has been released in v2.77.0 of the Terraform Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 18, 2021
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.

2 participants