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

Crash for import azurerm_public_ip #267

Closed
hashibot opened this issue Aug 24, 2017 · 4 comments · Fixed by #320
Closed

Crash for import azurerm_public_ip #267

hashibot opened this issue Aug 24, 2017 · 4 comments · Fixed by #320
Labels

Comments

@hashibot
Copy link

This issue was originally opened by @tvaroska as hashicorp/terraform#15898. It was migrated here as a result of the provider split. The original body of the issue is below.


terraform version 0.10.2

result of:
terraform import azurerm_public_ip.console /subscriptions/$ARM_SUBSCRIPTION_ID/resourceGroups/0_central/providers/Microsoft.Network/publicIPAdresses/console-ip

panic: runtime error: invalid memory address or nil pointer dereference
2017-08-24T04:33:26.188Z [DEBUG] plugin.terraform-provider-azurerm_v0.1.5_x4: [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xd113fb]
2017-08-24T04:33:26.188Z [DEBUG] plugin.terraform-provider-azurerm_v0.1.5_x4:
2017-08-24T04:33:26.188Z [DEBUG] plugin.terraform-provider-azurerm_v0.1.5_x4: goroutine 42 [running]:
2017-08-24T04:33:26.189Z [DEBUG] plugin.terraform-provider-azurerm_v0.1.5_x4: github.com/terraform-providers/terraform-provider-azurerm/azurerm.resourceArmPublicIpRead(0xc420112000, 0xec5860, 0xc42029e000, 0x0, 0x15b5bc0)
2017-08-24T04:33:26.189Z [DEBUG] plugin.terraform-provider-azurerm_v0.1.5_x4: /opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-azurerm/azurerm/resource_arm_public_ip.go:171 +0x3eb
2017-08-24T04:33:26.189Z [DEBUG] plugin.terraform-provider-azurerm_v0.1.5_x4: github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/helper/schema.(*Resource).Refresh(0xc4201dde00, 0xc420052230, 0xec5860, 0xc42029e000, 0xc42025e648, 0xc420335e01, 0x0)
2017-08-24T04:33:26.189Z [DEBUG] plugin.terraform-provider-azurerm_v0.1.5_x4: /opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/helper/schema/resource.go:314 +0x21d
2017-08-24T04:33:26.188Z [DEBUG] plugin: plugin process exited: path=/home/boris/infrastructure/.terraform/plugins/linux_amd64/terraform-provider-azurerm_v0.1.5_x4
2017-08-24T04:33:26.189Z [DEBUG] plugin.terraform-provider-azurerm_v0.1.5_x4: github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/helper/schema.(*Provider).Refresh(0xc4201e07e0, 0xc4200521e0, 0xc420052230, 0x7f4128ebb000, 0x0, 0x0)
2017-08-24T04:33:26.189Z [DEBUG] plugin.terraform-provider-azurerm_v0.1.5_x4: /opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/helper/schema/provider.go:267 +0x91
2017-08-24T04:33:26.189Z [DEBUG] plugin.terraform-provider-azurerm_v0.1.5_x4: github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/plugin.(*ResourceProviderServer).Refresh(0xc42010aa60, 0xc4203bfb30, 0xc4203bfdd0, 0x0, 0x0)
2017-08-24T04:33:26.189Z [DEBUG] plugin.terraform-provider-azurerm_v0.1.5_x4: /opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/plugin/resource_provider.go:510 +0x4e
2017-08-24T04:33:26.189Z [DEBUG] plugin.terraform-provider-azurerm_v0.1.5_x4: reflect.Value.call(0xc42001fbc0, 0xc42000c2c8, 0x13, 0xf8147c, 0x4, 0xc420566f20, 0x3, 0x3, 0xfc28f0, 0xc4204c36e8, ...)
2017-08-24T04:33:26.189Z [DEBUG] plugin.terraform-provider-azurerm_v0.1.5_x4: /usr/local/go/src/reflect/value.go:434 +0x91f
2017-08-24T04:33:26.189Z [DEBUG] plugin.terraform-provider-azurerm_v0.1.5_x4: reflect.Value.Call(0xc42001fbc0, 0xc42000c2c8, 0x13, 0xc4204c3720, 0x3, 0x3, 0xc4204c370c, 0x5355206c61727401, 0x200222c22)
2017-08-24T04:33:26.189Z [DEBUG] plugin.terraform-provider-azurerm_v0.1.5_x4: /usr/local/go/src/reflect/value.go:302 +0xa4
2017-08-24T04:33:26.189Z [DEBUG] plugin.terraform-provider-azurerm_v0.1.5_x4: net/rpc.(*service).call(0xc42011b5c0, 0xc42011b580, 0xc4201da180, 0xc42006ff80, 0xc42010b500, 0xdfa760, 0xc4203bfb30, 0x16, 0xdfa7a0, 0xc4203bfdd0, ...)
2017-08-24T04:33:26.189Z [DEBUG] plugin.terraform-provider-azurerm_v0.1.5_x4: /usr/local/go/src/net/rpc/server.go:387 +0x144
2017-08-24T04:33:26.189Z [DEBUG] plugin.terraform-provider-azurerm_v0.1.5_x4: created by net/rpc.(*Server).ServeCodec
2017-08-24T04:33:26.189Z [DEBUG] plugin.terraform-provider-azurerm_v0.1.5_x4: /usr/local/go/src/net/rpc/server.go:481 +0x404

@tombuildsstuff
Copy link
Contributor

Hey @tvaroska

Thanks for opening this issue :)

I've taken a quick look into this, from what I can see the Location isn't being returned in the API response. As far as I'm aware that's an invalid API response - and I'm having trouble reproducing this in my subscription - as such would it be possible for you to re-run terraform import with the TF_LOG environment variable set i.e.:

TF_LOG=1 terraform import azurerm_public_ip.console /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/0_central/providers/Microsoft.Network/publicIPAdresses/console-ip

This debug output will be written to stdout and will include the HTTP Requests and Responses from the Azure API's. Would it be possible to remove the sensitive Authorization field from the output and then post a link to this somewhere? I'm specifically after the response from the GET /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/0_central/providers/Microsoft.Network/publicIPAdresses/console-ip call if possible :)

Thanks!

@tvaroska
Copy link

@mbfrahry
Copy link
Member

mbfrahry commented Sep 7, 2017

Hey @tvaroska. Sorry for the delay but I am actively looking at this issue. I can see the problem but I'm having trouble replicating it.

So the GET uri is missing some information. This is from https://gist.github.com/tvaroska/858de0ca597a8ce89d046757d770a88c#file-terraform-log-L597
/subscriptions/$SUBSCRIPTION_ID/resourceGroups/0_central/providers/Microsoft.Network/publicIPAddresses/?api-version=2017-03-01. This grabs all the ips and we are getting a seg fault because Terraform assumes we are only getting one ip.
Normally the GET URI would look like /subscriptions/$SUBSCRIPTION_ID/resourceGroups/0_central/providers/Microsoft.Network/publicIPAddresses/console-ip?api-version=2017-03-01 so we are definitely losing information somewhere.

It looks like d.ID() from https://github.com/terraform-providers/terraform-provider-azurerm/blob/v0.1.5/azurerm/resource_arm_public_ip.go#L154 is set to an empty string so I'd like to take a look at your .tf file and see what it says. Can you send the .tf file you are using for the import?

Thank you for your patience!

@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!

@ghost ghost 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.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants