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

New resource: azurerm_vpn_gateway_connection #9160

Merged
merged 17 commits into from Nov 19, 2020

Conversation

magodo
Copy link
Collaborator

@magodo magodo commented Nov 5, 2020

Background

This resource helps users to create s2s connection under virtual wan. Essentially, it connects between a VPN Site (represents an on-premise network) and a vpn gateway in the virtual hub.

See the official tutorial for more info.

Test Result

💢 make testacc TEST=./azurerm/internal/services/network/tests TESTARGS='-run TestAccAzureRMVpnGatewayConnection_'
==> 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 ./azurerm/internal/services/network/tests -v -run TestAccAzureRMVpnGatewayConnection_ -timeout 180m -ldflags="-X=github.com/terraform-providers/terraform-provider-azurerm/version.ProviderVersion=acc"
=== RUN   TestAccAzureRMVpnGatewayConnection_basic
=== PAUSE TestAccAzureRMVpnGatewayConnection_basic
=== RUN   TestAccAzureRMVpnGatewayConnection_complete
=== PAUSE TestAccAzureRMVpnGatewayConnection_complete
=== RUN   TestAccAzureRMVpnGatewayConnection_update
=== PAUSE TestAccAzureRMVpnGatewayConnection_update
=== RUN   TestAccAzureRMVpnGatewayConnection_customRouteTable
=== PAUSE TestAccAzureRMVpnGatewayConnection_customRouteTable
=== RUN   TestAccAzureRMVpnGatewayConnection_requiresImport
=== PAUSE TestAccAzureRMVpnGatewayConnection_requiresImport
=== CONT  TestAccAzureRMVpnGatewayConnection_basic
=== CONT  TestAccAzureRMVpnGatewayConnection_customRouteTable
=== CONT  TestAccAzureRMVpnGatewayConnection_requiresImport
=== CONT  TestAccAzureRMVpnGatewayConnection_complete
=== CONT  TestAccAzureRMVpnGatewayConnection_update
--- PASS: TestAccAzureRMVpnGatewayConnection_requiresImport (4144.28s)
--- PASS: TestAccAzureRMVpnGatewayConnection_complete (4187.42s)
--- PASS: TestAccAzureRMVpnGatewayConnection_basic (4214.95s)
--- PASS: TestAccAzureRMVpnGatewayConnection_customRouteTable (4400.18s)
--- PASS: TestAccAzureRMVpnGatewayConnection_update (4593.23s)
PASS
ok      github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/network/tests       4593.302s

Design Concerns

One concern is that for routing_configuration property, if the user doesn't specify the route table, service will implicitly create one. This kind of behavior seems a leak of management from Terraform. So one alternative might be to set that property as Required and always force users to specify the route tables.

Copy link
Collaborator

@katbyte katbyte left a comment

Choose a reason for hiding this comment

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

Thanks @magodo, overall this looks good and i've left some comments inline to address. Is the reason we need to preserve the connections on the vpn gateway that these can be set via the new client & the existing vpn connection client?

@magodo
Copy link
Collaborator Author

magodo commented Nov 16, 2020

@katbyte Thank you for the review, I have resolved the comments, please take another look!

Regarding the changes to vpn gateway, yes, it is for reserving the connections purpose. Whilst after resolving the conflicts after merging to master branch, it appears that currently the update of vpn gateway will only do "patch" on top of the GET on the existing resource, so it means the connection will not be cleaned. So the only guarantee we need to keep is that the read-then-write operation happens as atomic, so the lock is needed only in update.

@magodo
Copy link
Collaborator Author

magodo commented Nov 16, 2020

The CI failure is unrelated to this PR...

@@ -123,7 +123,7 @@ func resourceArmVpnSite() *schema.Resource {
"asn": {
Type: schema.TypeInt,
Required: true,
ValidateFunc: validation.IntAtLeast(1),
ValidateFunc: validation.IntBetween(1, 4294967295),
Copy link
Member

Choose a reason for hiding this comment

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

@magodo - This upper boundary will break the 32-bit builds, I suspect that this change will need to be reverted. Is this field expecting asplain for the value, or can it take asdot+ also?

@katbyte
Copy link
Collaborator

katbyte commented Nov 18, 2020

@magodo - the CI failure is related to this PR, you have a 32bit int overflow

@katbyte katbyte added this to the v2.37.0 milestone Nov 19, 2020
Copy link
Collaborator

@katbyte katbyte left a comment

Choose a reason for hiding this comment

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

Thanks @magodo - LGTM 👍

@katbyte katbyte merged commit c4ec841 into hashicorp:master Nov 19, 2020
katbyte added a commit that referenced this pull request Nov 19, 2020
@ghost
Copy link

ghost commented Nov 20, 2020

This has been released in version 2.37.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example:

provider "azurerm" {
    version = "~> 2.37.0"
}
# ... other configuration ...

@ghost
Copy link

ghost commented Dec 20, 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 as resolved and limited conversation to collaborators Dec 20, 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.

None yet

4 participants