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

r/aws_lambda_function: terraform plan crashes on HasChange("filename") in CustomizeDiff introduced in #3032 #3605

Closed
erran opened this issue Mar 2, 2018 · 3 comments
Labels
bug Addresses a defect in current functionality. crash Results from or addresses a Terraform crash or kernel panic. service/lambda Issues and PRs that pertain to the lambda service.
Milestone

Comments

@erran
Copy link
Contributor

erran commented Mar 2, 2018

terraform version

Terraform v0.11.3

terraform-provider-aws version

Terraform v1.10.0

Affected Resource(s)

Please list the resources as a list, for example:

  • aws_lambda_function

Terraform Configuration Files

(omitted, I can make these generic but the above issues seem to document my problem already)

Panic Output

Panic crash.log (truncated), I can provide the whole log if necessary:
https://gist.github.com/erran/5d99bcd4fa5433adb636800e23abddec

crash-truncated.log (click to collapse)
2018/03/02 17:47:09 [INFO] Terraform version: 0.11.3  3802b14260603f90c7a1faf55994dcc8933e2069
2018/03/02 17:47:09 [INFO] Go runtime version: go1.9.1
2018/03/02 17:47:09 [INFO] CLI args: []string{"/Users/ecarey/rapid7/rad/tf-rad/staging/us-east-1/.tfenv/versions/0.11.3/terraform", "plan", "-target", "module.agent_auth_service.module.agent_auth_service.aws_lambda_function.lambda", "-out", "todo.tfplan"}
2018/03/02 17:47:09 [DEBUG] Attempting to open CLI config file: /Users/ecarey/.terraformrc
2018/03/02 17:47:09 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2018/03/02 17:47:09 [INFO] CLI command args: []string{"plan", "-target", "module.agent_auth_service.module.agent_auth_service.aws_lambda_function.lambda", "-out", "todo.tfplan"}

... TRUNCATED ...

2018-03-02T17:47:30.392Z [DEBUG] plugin.terraform-provider-aws_v1.10.0_x4: panic: runtime error: invalid memory address or nil pointer dereference
2018-03-02T17:47:30.392Z [DEBUG] plugin.terraform-provider-aws_v1.10.0_x4: [signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x1884397]
2018-03-02T17:47:30.392Z [DEBUG] plugin.terraform-provider-aws_v1.10.0_x4: 
2018-03-02T17:47:30.392Z [DEBUG] plugin.terraform-provider-aws_v1.10.0_x4: goroutine 424 [running]:
2018-03-02T17:47:30.393Z [DEBUG] plugin.terraform-provider-aws_v1.10.0_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema.(*DiffFieldReader).readPrimitive(0xc420ad3440, 0xc42091b8f0, 0x1, 0x1, 0xc4207a3d10, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
2018-03-02T17:47:30.393Z [DEBUG] plugin.terraform-provider-aws_v1.10.0_x4: 	/opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema/field_reader_diff.go:154 +0x207
2018-03-02T17:47:30.393Z [DEBUG] plugin.terraform-provider-aws_v1.10.0_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema.(*DiffFieldReader).ReadField(0xc420ad3440, 0xc42091b8f0, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
2018-03-02T17:47:30.393Z [DEBUG] plugin.terraform-provider-aws_v1.10.0_x4: 	/opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema/field_reader_diff.go:67 +0x559
2018-03-02T17:47:30.393Z [DEBUG] plugin.terraform-provider-aws_v1.10.0_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema.(*MultiLevelFieldReader).ReadFieldMerge(0xc42074fa20, 0xc42091b8f0, 0x1, 0x1, 0x35f25e4, 0x7, 0x0, 0x0, 0x0, 0x0, ...)
2018-03-02T17:47:30.393Z [DEBUG] plugin.terraform-provider-aws_v1.10.0_x4: 	/opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema/field_reader_multi.go:45 +0x260
2018-03-02T17:47:30.393Z [DEBUG] plugin.terraform-provider-aws_v1.10.0_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema.(*ResourceDiff).get(0xc420373ac0, 0xc42091b8f0, 0x1, 0x1, 0x35f25e4, 0x7, 0x0, 0x0, 0x0, 0x0, ...)
2018-03-02T17:47:30.393Z [DEBUG] plugin.terraform-provider-aws_v1.10.0_x4: 	/opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema/resource_diff.go:406 +0xe3
2018-03-02T17:47:30.393Z [DEBUG] plugin.terraform-provider-aws_v1.10.0_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema.(*ResourceDiff).getChange(0xc420373ac0, 0x3605b8b, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
2018-03-02T17:47:30.393Z [DEBUG] plugin.terraform-provider-aws_v1.10.0_x4: 	/opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema/resource_diff.go:399 +0x340
2018-03-02T17:47:30.393Z [DEBUG] plugin.terraform-provider-aws_v1.10.0_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema.(*ResourceDiff).GetChange(0xc420373ac0, 0x3605b8b, 0x10, 0x37e24a0, 0x1, 0x2dc1200, 0x37e24a0)
2018-03-02T17:47:30.393Z [DEBUG] plugin.terraform-provider-aws_v1.10.0_x4: 	/opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema/resource_diff.go:330 +0x9e
2018-03-02T17:47:30.393Z [DEBUG] plugin.terraform-provider-aws_v1.10.0_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema.(*ResourceDiff).HasChange(0xc420373ac0, 0x3605b8b, 0x10, 0x0)
2018-03-02T17:47:30.393Z [DEBUG] plugin.terraform-provider-aws_v1.10.0_x4: 	/opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema/resource_diff.go:358 +0x43
2018-03-02T17:47:30.393Z [DEBUG] plugin.terraform-provider-aws_v1.10.0_x4: github.com/terraform-providers/terraform-provider-aws/aws.needsFunctionCodeUpdate(0x517f9c0, 0xc420373ac0, 0xc420ad34a0)
2018-03-02T17:47:30.393Z [DEBUG] plugin.terraform-provider-aws_v1.10.0_x4: 	/opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_lambda_function.go:547 +0x145
2018-03-02T17:47:30.393Z [DEBUG] plugin.terraform-provider-aws_v1.10.0_x4: github.com/terraform-providers/terraform-provider-aws/aws.updateComputedAttributesOnPublish(0xc420373ac0, 0x31e03c0, 0xc4201b2500, 0xc4206cf800, 0xc420373ac0)
2018-03-02T17:47:30.393Z [DEBUG] plugin.terraform-provider-aws_v1.10.0_x4: 	/opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_lambda_function.go:209 +0x3b
2018-03-02T17:47:30.393Z [DEBUG] plugin.terraform-provider-aws_v1.10.0_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema.schemaMap.Diff(0xc4208d8a50, 0xc420677040, 0xc42042ba70, 0x368b0b0, 0x31e03c0, 0xc4201b2500, 0xc42026d630, 0xc42038da01, 0x1028eb8)
2018-03-02T17:47:30.393Z [DEBUG] plugin.terraform-provider-aws_v1.10.0_x4: 	/opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema/schema.go:435 +0xb62
2018-03-02T17:47:30.393Z [DEBUG] plugin.terraform-provider-aws_v1.10.0_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema.(*Resource).Diff(0xc4202952d0, 0xc420677040, 0xc42042ba70, 0x31e03c0, 0xc4201b2500, 0x1, 0xc42052e570, 0xc42038dad8)
2018-03-02T17:47:30.393Z [DEBUG] plugin.terraform-provider-aws_v1.10.0_x4: 	/opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema/resource.go:252 +0x187

Expected Behavior

What should have happened?

The plan should succeed like it did before upgrading from v1.9.0.

Actual Behavior

What actually happened?

terraform plan crashes. 💥

Steps to Reproduce

  1. terraform plan with a aws_lambda_function resource which has filename unset in the state file.

Setting filename to empty string in the statefile seemed to move the error to source_code_hash which was computed before in my case.

References

Are there any other GitHub issues (open or closed) or Pull Requests that should be linked here? For example:

It looks like hashicorp/terraform#17261 this issue which started happening in this resource after #3032 was released.

See also #3194 (comment) which is blocked by another place this issue is hit.

@bflad bflad added bug Addresses a defect in current functionality. crash Results from or addresses a Terraform crash or kernel panic. service/lambda Issues and PRs that pertain to the lambda service. labels Mar 5, 2018
@bflad
Copy link
Contributor

bflad commented Mar 16, 2018

Hi @erran! 👋 Sorry I didn't immediately respond here to say what we were thinking. 😖 We now have updated the upstream hashicorp/terraform dependency in this provider that should include the fix you mentioned (great find!). Are you able to try a custom build of the provider from master to verify its fixed or if we'll need additional remediation? Thanks so much!

@bflad bflad added this to the v1.12.0 milestone Mar 16, 2018
@erran erran closed this as completed Mar 23, 2018
@erran
Copy link
Contributor Author

erran commented Mar 23, 2018

🎉 Thanks for the update @bflad, no worries I didn't really expect a response since the fix was clear (waiting on updated vendor) and there was an easy work around (pinning the provider version).

I pulled 698f9e3#diff-7c3613dba5171cb6027c67835dd3b9d4 into a branch of mine and was able to validate the update resolved my issue. Sorry for the slow response!

@ghost
Copy link

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

@ghost ghost locked and limited conversation to collaborators Apr 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. crash Results from or addresses a Terraform crash or kernel panic. service/lambda Issues and PRs that pertain to the lambda service.
Projects
None yet
Development

No branches or pull requests

2 participants