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

Terraform Plan crashes when there are changes to existing resources #4770

Closed
Gustavo-Benitez opened this issue Oct 29, 2019 · 6 comments
Closed
Assignees
Labels

Comments

@Gustavo-Benitez
Copy link

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment
  • If an issue is assigned to the "modular-magician" user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned to "hashibot", a community member has claimed the issue already.

Terraform Version

Terraform v0.12.12

  • provider.google v2.18.0
  • provider.google-beta v2.18.0

Affected Resource(s)

plugin.terraform-provider-google_v2.18.0_x4

Debug Output

2019-10-29T10:37:52.354Z [DEBUG] plugin.terraform-provider-google_v2.18.0_x4: panic: runtime error: invalid memory address or nil pointer dereference
2019-10-29T10:37:52.354Z [DEBUG] plugin.terraform-provider-google_v2.18.0_x4: [signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0xd9a157]
2019-10-29T10:37:52.354Z [DEBUG] plugin.terraform-provider-google_v2.18.0_x4: 
2019-10-29T10:37:52.354Z [DEBUG] plugin.terraform-provider-google_v2.18.0_x4: goroutine 223 [running]:
2019-10-29T10:37:52.354Z [DEBUG] plugin.terraform-provider-google_v2.18.0_x4: github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin.(*GRPCProviderServer).PlanResourceChange(0xc00013ebe8, 0x26f2580, 0xc000682db0, 0xc00084f260, 0xc00013ebe8, 0xc000682db0, 0xc000705a80)
2019-10-29T10:37:52.354Z [DEBUG] plugin.terraform-provider-google_v2.18.0_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/terraform-plugin-sdk@v1.0.0/internal/helper/plugin/grpc_provider.go:739 +0xff7
2019-10-29T10:37:52.354Z [DEBUG] plugin.terraform-provider-google_v2.18.0_x4: github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5._Provider_PlanResourceChange_Handler(0x22a1cc0, 0xc00013ebe8, 0x26f2580, 0xc000682db0, 0xc00084f200, 0x0, 0x26f2580, 0xc000682db0, 0xc00001a000, 0x1b8d)
2019-10-29T10:37:52.354Z [DEBUG] plugin.terraform-provider-google_v2.18.0_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/terraform-plugin-sdk@v1.0.0/internal/tfplugin5/tfplugin5.pb.go:3171 +0x217
2019-10-29T10:37:52.354Z [DEBUG] plugin.terraform-provider-google_v2.18.0_x4: google.golang.org/grpc.(*Server).processUnaryRPC(0xc0000e4160, 0x27227c0, 0xc00008be00, 0xc000723d00, 0xc000134ff0, 0x34a4b48, 0x0, 0x0, 0x0)
2019-10-29T10:37:52.354Z [DEBUG] plugin.terraform-provider-google_v2.18.0_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/google.golang.org/grpc@v1.23.0/server.go:995 +0x460
2019-10-29T10:37:52.354Z [DEBUG] plugin.terraform-provider-google_v2.18.0_x4: google.golang.org/grpc.(*Server).handleStream(0xc0000e4160, 0x27227c0, 0xc00008be00, 0xc000723d00, 0x0)
2019-10-29T10:37:52.354Z [DEBUG] plugin.terraform-provider-google_v2.18.0_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/google.golang.org/grpc@v1.23.0/server.go:1275 +0xd97
2019-10-29T10:37:52.354Z [DEBUG] plugin.terraform-provider-google_v2.18.0_x4: google.golang.org/grpc.(*Server).serveStreams.func1.1(0xc0000b5860, 0xc0000e4160, 0x27227c0, 0xc00008be00, 0xc000723d00)
2019-10-29T10:37:52.354Z [DEBUG] plugin.terraform-provider-google_v2.18.0_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/google.golang.org/grpc@v1.23.0/server.go:710 +0xbb
2019-10-29T10:37:52.354Z [DEBUG] plugin.terraform-provider-google_v2.18.0_x4: created by google.golang.org/grpc.(*Server).serveStreams.func1
2019-10-29T10:37:52.354Z [DEBUG] plugin.terraform-provider-google_v2.18.0_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/google.golang.org/grpc@v1.23.0/server.go:708 +0xa1
2019-10-29T10:37:52.357Z [DEBUG] plugin: plugin process exited: path=/opt/jenkins/production/workspace/DTO-Tools/Jenkins-HA-Infra-Build/prod/terraform/.terraform/plugins/linux_amd64/terraform-provider-google_v2.18.0_x4 pid=16558 error="exit status 2"

Panic Output

2019-10-29T10:37:52.354Z [DEBUG] plugin.terraform-provider-google_v2.18.0_x4: panic: runtime error: invalid memory address or nil pointer dereference
2019-10-29T10:37:52.354Z [DEBUG] plugin.terraform-provider-google_v2.18.0_x4: [signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0xd9a157]

Expected Behavior

Terraform should have generated a plan or an error should have been produced if the plan could not be generated.

Actual Behavior

Terraform crashed when running a plan

Steps to Reproduce

  1. terraform plan -out=plan.tfplan -no-color

Important Factoids

The same issue was observed using:

  • Google Provider 2.13 and terraform 0.12.0
  • Google Provider 2.13 and terraform 0.12.12
  • Google Provider 2.18 and terraform 0.12.12

References

  • #0000
@ghost ghost added the bug label Oct 29, 2019
@tysen
Copy link

tysen commented Oct 30, 2019

Which resource? This looks very similar to #4756 for which a fix was just merged.

@Gustavo-Benitez
Copy link
Author

@tysen Thanks for the quick response.

Just a quick update:
Since I'm using the google_compute_instance_group_manager from the Google Beta Provider, the issue could be related to #4756 as you say, since a Container Cluster and an Instance Group Manager are related. However, in the crash.log, it seems to refresh the state of that resource fine (first line in the log snippet below):

I have tried using the Google Beta Provider 2.17 as many people mentioned it in #4756, but I get the same crash.

I could not pin-point the issue to a specific resource but, if I can assume that the last resource shown in the log before the crash is the culprit, then it should be: google_compute_global_forwarding_rule of the Google Provider ( Tested with 2.13 and 2.18 ).

08:58:51  google_compute_instance_group_manager.jenkins-master-mig-prod: Refreshing state... [id=*****/europe-west1-b/jenkins-master-mig-prod]
08:58:51  google_service_account_key.jenkins-prod-key: Refreshing state... [id=projects/*****/serviceAccounts/jenkins-prod@*****.iam.gserviceaccount.com/keys/*****]
08:58:51  google_compute_backend_service.jenkins-master-backend-service: Refreshing state... [id=jenkins-master-backend-service]
08:58:51  google_storage_bucket_object.jenkins-prod-key: Refreshing state... [id=*****-server-secrets-jenkins-prod-key.json]
08:58:51  google_compute_url_map.jenkins-master-url-map: Refreshing state... [id=jenkins-master-url-map]
08:58:51  google_compute_target_https_proxy.jenkins-master-target-https-proxy: Refreshing state... [id=jenkins-master-target-https-proxy]
08:58:51  google_compute_global_forwarding_rule.jenkins-master-global-forwarding-rule: Refreshing state... [id=jenkins-master-global-forwarding-rule]
<CRASH>

@ghost ghost removed the waiting-response label Oct 31, 2019
@tysen
Copy link

tysen commented Nov 12, 2019

Can you provide an example config so I can reproduce this behavior?

@venkykuberan
Copy link
Contributor

@Gustavo-Benitez,
If you still need help can you please provide the config to repro ?

@Gustavo-Benitez
Copy link
Author

@venkykuberan Thank you. I cannot provide the code however, upgrading to terraform 0.12.18 and using Google Provider 2.19 seems to have had a positive effect. I believe the resource that was corrupt on every state file was the Google Provider compute_global_forwarding_rule

@ghost
Copy link

ghost commented Feb 15, 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 Feb 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants