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

Bugfix: panic when importing azure_app_service_plan #3657

Merged
merged 1 commit into from
Jun 14, 2019

Conversation

maxbog
Copy link
Contributor

@maxbog maxbog commented Jun 14, 2019

When importing an azurerm_app_service_plan resource, I got an error:

Error: rpc error: code = Unavailable desc = transport is closing

The TRACE logs showed a panic:

2019-06-14T09:00:14.700+0200 [DEBUG] plugin.terraform-provider-azurerm_v1.30.1_x4.exe: panic: runtime error: invalid memory address or nil pointer dereference
2019-06-14T09:00:14.700+0200 [DEBUG] plugin.terraform-provider-azurerm_v1.30.1_x4.exe: [signal 0xc0000005 code=0x0 addr=0x78 pc=0x26b04a5]
2019-06-14T09:00:14.700+0200 [DEBUG] plugin.terraform-provider-azurerm_v1.30.1_x4.exe: 
2019-06-14T09:00:14.700+0200 [DEBUG] plugin.terraform-provider-azurerm_v1.30.1_x4.exe: goroutine 15 [running]:
2019-06-14T09:00:14.700+0200 [DEBUG] plugin.terraform-provider-azurerm_v1.30.1_x4.exe: github.com/terraform-providers/terraform-provider-azurerm/azurerm.resourceArmAppServicePlanRead(0xc0003cd260, 0x30546c0, 0xc00094c000, 0xc0003cd260, 0x0)
2019-06-14T09:00:14.700+0200 [DEBUG] plugin.terraform-provider-azurerm_v1.30.1_x4.exe: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-azurerm/azurerm/resource_arm_app_service_plan.go:288 +0x735
2019-06-14T09:00:14.700+0200 [DEBUG] plugin.terraform-provider-azurerm_v1.30.1_x4.exe: github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/helper/schema.(*Resource).RefreshWithoutUpgrade(0xc000517e80, 0xc00016b900, 0x30546c0, 0xc00094c000, 0xc00078d5f0, 0xc00016b900, 0x0)
2019-06-14T09:00:14.700+0200 [DEBUG] plugin.terraform-provider-azurerm_v1.30.1_x4.exe: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/helper/schema/resource.go:447 +0x123
2019-06-14T09:00:14.700+0200 [DEBUG] plugin.terraform-provider-azurerm_v1.30.1_x4.exe: github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/helper/plugin.(*GRPCProviderServer).ReadResource(0xc00014e458, 0x355a020, 0xc00078c600, 0xc000636280, 0xc00014e458, 0xc00078c570, 0x2d3a820)
2019-06-14T09:00:14.700+0200 [DEBUG] plugin.terraform-provider-azurerm_v1.30.1_x4.exe: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/helper/plugin/grpc_provider.go:496 +0x312
2019-06-14T09:00:14.700+0200 [DEBUG] plugin.terraform-provider-azurerm_v1.30.1_x4.exe: github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/internal/tfplugin5._Provider_ReadResource_Handler(0x2fce620, 0xc00014e458, 0x355a020, 0xc00078c600, 0xc00016b770, 0x0, 0x0, 0x0, 0xc000864480, 0x162)
2019-06-14T09:00:14.700+0200 [DEBUG] plugin.terraform-provider-azurerm_v1.30.1_x4.exe: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/internal/tfplugin5/tfplugin5.pb.go:2983 +0x245
2019-06-14T09:00:14.700+0200 [DEBUG] plugin.terraform-provider-azurerm_v1.30.1_x4.exe: github.com/terraform-providers/terraform-provider-azurerm/vendor/google.golang.org/grpc.(*Server).processUnaryRPC(0xc00016d800, 0x3576460, 0xc0004a0600, 0xc000703e00, 0xc00058f110, 0x5f08e50, 0x0, 0x0, 0x0)
2019-06-14T09:00:14.700+0200 [DEBUG] plugin.terraform-provider-azurerm_v1.30.1_x4.exe: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-azurerm/vendor/google.golang.org/grpc/server.go:966 +0x4a9
2019-06-14T09:00:14.700+0200 [DEBUG] plugin.terraform-provider-azurerm_v1.30.1_x4.exe: github.com/terraform-providers/terraform-provider-azurerm/vendor/google.golang.org/grpc.(*Server).handleStream(0xc00016d800, 0x3576460, 0xc0004a0600, 0xc000703e00, 0x0)
2019-06-14T09:00:14.700+0200 [DEBUG] plugin.terraform-provider-azurerm_v1.30.1_x4.exe: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-azurerm/vendor/google.golang.org/grpc/server.go:1245 +0xd68
2019-06-14T09:00:14.700+0200 [DEBUG] plugin.terraform-provider-azurerm_v1.30.1_x4.exe: github.com/terraform-providers/terraform-provider-azurerm/vendor/google.golang.org/grpc.(*Server).serveStreams.func1.1(0xc000240090, 0xc00016d800, 0x3576460, 0xc0004a0600, 0xc000703e00)
2019-06-14T09:00:14.700+0200 [DEBUG] plugin.terraform-provider-azurerm_v1.30.1_x4.exe: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-azurerm/vendor/google.golang.org/grpc/server.go:685 +0xa6
2019-06-14T09:00:14.700+0200 [DEBUG] plugin.terraform-provider-azurerm_v1.30.1_x4.exe: created by github.com/terraform-providers/terraform-provider-azurerm/vendor/google.golang.org/grpc.(*Server).serveStreams.func1
2019-06-14T09:00:14.700+0200 [DEBUG] plugin.terraform-provider-azurerm_v1.30.1_x4.exe: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-azurerm/vendor/google.golang.org/grpc/server.go:683 +0xa8
2019/06/14 09:00:14 [ERROR] module.web_apps: eval: *terraform.EvalRefresh, err: rpc error: code = Unavailable desc = transport is closing

After some investigation I discovered that the web.AppServicePlan type does not have a IsXenon property, which is in fact present on web.AppServicePlanProperties. After populating is_xenon property from a correct place, the panic no longer occurs.

This leaves me wondering, how does the original code even compile, with a reference to a non-existent property?

@ghost ghost added the size/XS label Jun 14, 2019
@maxbog maxbog force-pushed the b/move_is_xenon_prop branch from 3af8f3d to b7f0606 Compare June 14, 2019 08:38
@pavelliano
Copy link

pavelliano commented Jun 14, 2019

Anyone can please merge this branch? :)

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 for the fix @maxbog! LGTM

@katbyte katbyte added this to the v1.31.0 milestone Jun 14, 2019
katbyte added a commit that referenced this pull request Jun 14, 2019
@katbyte katbyte merged commit 4320131 into hashicorp:master Jun 14, 2019
@katbyte
Copy link
Collaborator

katbyte commented Jun 14, 2019

@maxbog, the Properties struct is anonymous so its properties can be accessed like that. However if properties is nill accessing them can fail as you see here.

@ghost
Copy link

ghost commented Jun 28, 2019

This has been released in version 1.31.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 = "~> 1.31.0"
}
# ... other configuration ...

@ghost
Copy link

ghost commented Jul 15, 2019

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 Jul 15, 2019
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.

3 participants