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

Fix import of public ip of a network interface #128

Merged

Conversation

thiagocaiubi
Copy link
Contributor

Fix runtime error on conversion of *string to string when presence of public ip

Before:

$ make testacc TEST=./azurerm TESTARGS="-run
TestAccAzureRMNetworkInterface_importPublicIP"
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./azurerm -v -run
TestAccAzureRMNetworkInterface_importPublicIP -timeout 120m
=== RUN   TestAccAzureRMNetworkInterface_importPublicIP
panic: interface conversion: interface {} is *string, not string

goroutine 393 [running]:
github.com/terraform-providers/terraform-provider-azurerm/azurerm.resourceArmNetworkInterfaceIpConfigurationHash(0x183ad00, 0xc4201aa4b0, 0xc4202a9478)
        /Users/thiagocaiubi/Development/go/src/github.com/terraform-providers/terraform-provider-azurerm/azurerm/resource_arm_network_interface_card.go:401 +0xa75
github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/helper/schema.(*Set).hash(0xc4202a9460, 0x183ad00, 0xc4201aa4b0, 0x10, 0x20)
        /Users/thiagocaiubi/Development/go/src/github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/helper/schema/set.go:180 +0x3d
github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/helper/schema.(*Set).add(0xc4202a9460, 0x183ad00, 0xc4201aa4b0, 0x1884d00, 0x1, 0xc4202a9460)
        /Users/thiagocaiubi/Development/go/src/github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/helper/schema/set.go:167 +0x81
github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/helper/schema.(*Set).Add(0xc4202a9460, 0x183ad00, 0xc4201aa4b0)
        /Users/thiagocaiubi/Development/go/src/github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/helper/schema/set.go:69 +0x44
github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/helper/schema.NewSet(0x198c5e8, 0xc4202fac30, 0x1, 0x1, 0xc4202fac00)
        /Users/thiagocaiubi/Development/go/src/github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/helper/schema/set.go:56 +0xa2
github.com/terraform-providers/terraform-provider-azurerm/azurerm.resourceArmNetworkInterfaceRead(0xc4201cda40, 0x1875c20, 0xc4202ee000, 0xc4203690e0, 0x0)

After:

$ make testacc TEST=./azurerm TESTARGS="-run
TestAccAzureRMNetworkInterface_importPublicIP"
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./azurerm -v -run
TestAccAzureRMNetworkInterface_importPublicIP -timeout 120m
=== RUN   TestAccAzureRMNetworkInterface_importPublicIP
--- PASS: TestAccAzureRMNetworkInterface_importPublicIP (120.69s)
PASS
ok github.com/terraform-providers/terraform-provider-azurerm/azurerm 120.801s

public ip

Before:

```
$ make testacc TEST=./azurerm TESTARGS="-run
TestAccAzureRMNetworkInterface_importPublicIP"
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./azurerm -v -run
TestAccAzureRMNetworkInterface_importPublicIP -timeout 120m
=== RUN   TestAccAzureRMNetworkInterface_importPublicIP
panic: interface conversion: interface {} is *string, not string

goroutine 393 [running]:
github.com/terraform-providers/terraform-provider-azurerm/azurerm.resourceArmNetworkInterfaceIpConfigurationHash(0x183ad00, 0xc4201aa4b0, 0xc4202a9478)
        /Users/thiagocaiubi/Development/go/src/github.com/terraform-providers/terraform-provider-azurerm/azurerm/resource_arm_network_interface_card.go:401 +0xa75
github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/helper/schema.(*Set).hash(0xc4202a9460, 0x183ad00, 0xc4201aa4b0, 0x10, 0x20)
        /Users/thiagocaiubi/Development/go/src/github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/helper/schema/set.go:180 +0x3d
github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/helper/schema.(*Set).add(0xc4202a9460, 0x183ad00, 0xc4201aa4b0, 0x1884d00, 0x1, 0xc4202a9460)
        /Users/thiagocaiubi/Development/go/src/github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/helper/schema/set.go:167 +0x81
github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/helper/schema.(*Set).Add(0xc4202a9460, 0x183ad00, 0xc4201aa4b0)
        /Users/thiagocaiubi/Development/go/src/github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/helper/schema/set.go:69 +0x44
github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/helper/schema.NewSet(0x198c5e8, 0xc4202fac30, 0x1, 0x1, 0xc4202fac00)
        /Users/thiagocaiubi/Development/go/src/github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/helper/schema/set.go:56 +0xa2
github.com/terraform-providers/terraform-provider-azurerm/azurerm.resourceArmNetworkInterfaceRead(0xc4201cda40, 0x1875c20, 0xc4202ee000, 0xc4203690e0, 0x0)
```

After:

```
$ make testacc TEST=./azurerm TESTARGS="-run
TestAccAzureRMNetworkInterface_importPublicIP"
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./azurerm -v -run
TestAccAzureRMNetworkInterface_importPublicIP -timeout 120m
=== RUN   TestAccAzureRMNetworkInterface_importPublicIP
--- PASS: TestAccAzureRMNetworkInterface_importPublicIP (120.69s)
PASS
ok github.com/terraform-providers/terraform-provider-azurerm/azurerm 120.801s
```
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 @thiagocaiubi

Thanks for this PR - I've taken a look and this LGTM. The tests pass:

$ TF_ACC=1 envchain azurerm go test ./azurerm -v -timeout 300m -parallel 5 -run TestAccAzureRMNetworkInterface_

=== RUN   TestAccAzureRMNetworkInterface_importBasic
--- PASS: TestAccAzureRMNetworkInterface_importBasic (122.32s)
=== RUN   TestAccAzureRMNetworkInterface_importIPForwarding
--- PASS: TestAccAzureRMNetworkInterface_importIPForwarding (104.43s)
=== RUN   TestAccAzureRMNetworkInterface_importWithTags
--- PASS: TestAccAzureRMNetworkInterface_importWithTags (103.86s)
=== RUN   TestAccAzureRMNetworkInterface_importMultipleLoadBalancers
--- PASS: TestAccAzureRMNetworkInterface_importMultipleLoadBalancers (161.74s)
=== RUN   TestAccAzureRMNetworkInterface_importPublicIP
--- PASS: TestAccAzureRMNetworkInterface_importPublicIP (123.31s)
=== RUN   TestAccAzureRMNetworkInterface_basic
--- PASS: TestAccAzureRMNetworkInterface_basic (117.47s)
=== RUN   TestAccAzureRMNetworkInterface_disappears
--- PASS: TestAccAzureRMNetworkInterface_disappears (168.43s)
=== RUN   TestAccAzureRMNetworkInterface_enableIPForwarding
--- PASS: TestAccAzureRMNetworkInterface_enableIPForwarding (117.67s)
=== RUN   TestAccAzureRMNetworkInterface_multipleLoadBalancers
--- PASS: TestAccAzureRMNetworkInterface_multipleLoadBalancers (141.21s)
=== RUN   TestAccAzureRMNetworkInterface_withTags
--- PASS: TestAccAzureRMNetworkInterface_withTags (116.26s)
=== RUN   TestAccAzureRMNetworkInterface_bug7986
--- PASS: TestAccAzureRMNetworkInterface_bug7986 (119.54s)
PASS
ok  	github.com/terraform-providers/terraform-provider-azurerm/azurerm	1396.245s

Thanks!

@tombuildsstuff tombuildsstuff merged commit ed4296a into hashicorp:master Jun 26, 2017
tombuildsstuff added a commit that referenced this pull request Jun 26, 2017
tombuildsstuff added a commit that referenced this pull request Jul 4, 2017
Fix import of public ip of a network interface
tombuildsstuff added a commit that referenced this pull request Jul 4, 2017
@ghost
Copy link

ghost commented Apr 1, 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!

@ghost ghost locked and limited conversation to collaborators Apr 1, 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.

2 participants