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

Data Source: Adding azurerm_vpn_gateway #12844

Merged
merged 7 commits into from
Aug 12, 2021
Merged

Data Source: Adding azurerm_vpn_gateway #12844

merged 7 commits into from
Aug 12, 2021

Conversation

catriona-m
Copy link
Member

fixes #10703

Copy link
Contributor

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

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

hey @catriona-m

Thanks for this PR - I've taken a look through and left a few comments inline but if we can fix those up then this otherwise LGTM 👍

Thanks!

Elem: &pluginsdk.Resource{
Schema: map[string]*pluginsdk.Schema{
"custom_ips": {
Type: pluginsdk.TypeSet,
Copy link
Contributor

Choose a reason for hiding this comment

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

I have a feeling this'll need to be a List given this is a data source (else they all get the same hash value)

},

"default_ips": {
Type: pluginsdk.TypeSet,
Copy link
Contributor

Choose a reason for hiding this comment

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

same here

},

"tunnel_ips": {
Type: pluginsdk.TypeSet,
Copy link
Contributor

Choose a reason for hiding this comment

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

same here

},

"default_ips": {
Type: pluginsdk.TypeSet,
Copy link
Contributor

Choose a reason for hiding this comment

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

same here

Elem: &pluginsdk.Resource{
Schema: map[string]*pluginsdk.Schema{
"custom_ips": {
Type: pluginsdk.TypeSet,
Copy link
Contributor

Choose a reason for hiding this comment

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

same here

},

"tunnel_ips": {
Type: pluginsdk.TypeSet,
Copy link
Contributor

Choose a reason for hiding this comment

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

same here

Comment on lines 155 to 169
name := d.Get("name").(string)
resourceGroup := d.Get("resource_group_name").(string)

resp, err := client.Get(ctx, resourceGroup, name)
if err != nil {
if utils.ResponseWasNotFound(resp.Response) {
log.Printf("[DEBUG] VPN Gateway %q was not found in Resource Group %q - removing from state", name, resourceGroup)
d.SetId("")
return nil
}

return fmt.Errorf("Error retrieving VPN Gateway %q (Resource Group %q): %+v", name, resourceGroup, err)
}

if resp.ID != nil {
d.SetId(*resp.ID)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

rather than relying on the Azure ID, can we add a Resource ID Parser for this and use that value instead? (see this PR for an example #10128)

@katbyte
Copy link
Collaborator

katbyte commented Aug 12, 2021

got an error while running the tests for this:
``
------- Stdout: -------
=== RUN TestAccVPNGatewayDataSource_complete
=== PAUSE TestAccVPNGatewayDataSource_complete
=== CONT TestAccVPNGatewayDataSource_complete
testcase.go:88: Step 1/1 error: Error running apply: exit status 1

    Error: waiting for creation of Virtual Hub "acctestVPNG-210812043547295198" (Resource Group "acctestRG-210812043547295198"): VPN Gateway "acctestVPNG-210812043547295198" (Resource Group "acctestRG-210812043547295198") is in provisioningState `Failed`
    
      with azurerm_vpn_gateway.test,
      on terraform_plugin_test.tf line 32, in resource "azurerm_vpn_gateway" "test":
      32: resource "azurerm_vpn_gateway" "test" {
    
testing_new.go:70: Error running post-test destroy, there may be dangling resources: exit status 1
    
    Error: deleting Virtual Hub "acctestvh-210812043547295198" (Resource Group "acctestRG-210812043547295198"): network.VirtualHubsClient#Delete: Failure sending request: StatusCode=0 -- Original Error: Code="CannotDeleteVirtualHubWhenItIsInUse" Message="VirtualHub /subscriptions/*******/resourceGroups/acctestRG-210812043547295198/providers/Microsoft.Network/virtualHubs/acctestvh-210812043547295198 cannot be deleted as it is in use by /subscriptions/*******/resourceGroups/acctestRG-210812043547295198/providers/Microsoft.Network/vpnGateways/acctestVPNG-210812043547295198." Details=[]

--- FAIL: TestAccVPNGatewayDataSource_complete (1481.37s)
FAIL

@catriona-m catriona-m merged commit 5747429 into main Aug 12, 2021
@catriona-m catriona-m deleted the cm/ds_vpn_gateway branch August 12, 2021 16:55
catriona-m added a commit that referenced this pull request Aug 12, 2021
@katbyte katbyte added this to the v2.73.0 milestone Aug 12, 2021
@github-actions
Copy link

This functionality has been released in v2.73.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 Sep 20, 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.

New Data Source: azurerm_vpn_gateway
3 participants