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

panic: runtime error: invalid memory address or nil pointer dereference #1349

Closed
hylaride opened this issue Aug 4, 2017 · 9 comments
Closed

Comments

@hylaride
Copy link

hylaride commented Aug 4, 2017

Terraform Version

0.10.0

Affected Resource(s)

I'm not 100% sure. I did a terraform plan after the upgrade (and a terraform init as per the upgrade instructions) and the crash happened. I think it may be related to remote S3 state?

Debug Output

Debug Output

Panic Output

crash.log

Expected Behavior

terraform plan should have run as expected

Actual Behavior

Terraform crashed

Steps to Reproduce

  1. terraform apply after upgrading to 0.10.0 with remote s3 state
@opalmer
Copy link

opalmer commented Aug 4, 2017

I can confirm I'm having this problem too and my steps to reproduce were nearly identical:

  1. terraform init
  2. terraform plan

I'm too am also using remote S3 state as well as locks in DynamoDB. Out of the three sets of templates I have I can only reproduce the crash in one. I'm going to see if I can narrow down exactly how this is happening.

@opalmer
Copy link

opalmer commented Aug 4, 2017

See updated comment below.

Ok so @hylaride and I are crashing in the same place, added part of my own logs below. Looking at the code's history this may be the cause but I'm unsure why right now.

Adding in @joshuaspence / @radeksimko since they were the last ones to look at this particular bit of code. I'm new to Terraform but no stranger to Go so I'm going to try and take a look at this myself once I figure out how to use the plugin produced by make build. Certainly welcome to someone else looking though if they can do it faster or know what the issue is already.

2017/08/04 18:02:39 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4: 2017/08/04 18:02:39 [WARN] VPC Classic Link DNS Support is not supported in this region
2017/08/04 18:02:40 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4: 2017/08/04 18:02:40 [DEBUG] S3 Bucket: [OMITTED], versioning: {
2017/08/04 18:02:40 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4:   MFADelete: "Disabled",
2017/08/04 18:02:40 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4:   Status: "Enabled"
2017/08/04 18:02:40 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4: }
2017/08/04 18:02:40 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4: 2017/08/04 18:02:40 [DEBUG] S3 bucket: [OMITTED], read Acceleration: {
2017/08/04 18:02:40 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4: 
2017/08/04 18:02:40 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4: }
2017/08/04 18:02:40 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4: 2017/08/04 18:02:40 [DEBUG] S3 Bucket: [OMITTED], read request payer: {
2017/08/04 18:02:40 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4:   Payer: "BucketOwner"
2017/08/04 18:02:40 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4: }
2017/08/04 18:02:40 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4: 2017/08/04 18:02:40 [DEBUG] S3 Bucket: [OMITTED], logging: {
2017/08/04 18:02:40 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4:   LoggingEnabled: {
2017/08/04 18:02:40 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4:     TargetBucket: "[OMITTED]",
2017/08/04 18:02:40 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4:     TargetPrefix: "[OMITTED]/"
2017/08/04 18:02:40 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4:   }
2017/08/04 18:02:40 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4: }
2017/08/04 18:02:40 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4: 2017/08/04 18:02:40 [DEBUG] S3 Bucket: [OMITTED], lifecycle: {
2017/08/04 18:02:40 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4:   Rules: [{
2017/08/04 18:02:40 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4:       ID: "tf-s3-lifecycle-00de480663a443ff35057963b6",
2017/08/04 18:02:40 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4:       NoncurrentVersionExpiration: {
2017/08/04 18:02:40 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4:         NoncurrentDays: 90
2017/08/04 18:02:40 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4:       },
2017/08/04 18:02:40 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4:       NoncurrentVersionTransitions: [{
2017/08/04 18:02:40 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4:           NoncurrentDays: 30,
2017/08/04 18:02:40 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4:           StorageClass: "STANDARD_IA"
2017/08/04 18:02:40 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4:         }],
2017/08/04 18:02:40 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4:       Prefix: "hosts/",
2017/08/04 18:02:40 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4:       Status: "Enabled"
2017/08/04 18:02:40 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4:     },{
2017/08/04 18:02:40 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4:       ID: "tf-s3-lifecycle-00ad74305a8b807488a63f691a",
2017/08/04 18:02:40 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4:       NoncurrentVersionExpiration: {
2017/08/04 18:02:40 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4:         NoncurrentDays: 14
2017/08/04 18:02:40 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4:       },
2017/08/04 18:02:40 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4:       Prefix: "env:/",
2017/08/04 18:02:40 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4:       Status: "Enabled"
2017/08/04 18:02:40 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4:     }]
2017/08/04 18:02:40 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4: }
2017/08/04 18:02:40 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4: panic: runtime error: invalid memory address or nil pointer dereference
2017/08/04 18:02:40 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4: [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x17a1fcf]
2017/08/04 18:02:40 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4: 
2017/08/04 18:02:40 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4: goroutine 104 [running]:
2017/08/04 18:02:40 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4: github.com/terraform-providers/terraform-provider-aws/aws.resourceAwsS3BucketRead(0xc4201a23f0, 0x1d9b840, 0xc42013e600, 0x0, 0x3403ba0)
2017/08/04 18:02:40 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4: 	/opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_s3_bucket.go:787 +0x1b3f
2017/08/04 18:02:40 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema.(*Resource).Refresh(0xc420321da0, 0xc42012c230, 0x1d9b840, 0xc42013e600, 0xc42059f750, 0xc4204f8501, 0x0)
2017/08/04 18:02:40 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4: 	/opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema/resource.go:320 +0x21d
2017/08/04 18:02:40 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema.(*Provider).Refresh(0xc4201a2000, 0xc42012c1e0, 0xc42012c230, 0x7f49a14fd000, 0x0, 0x0)
2017/08/04 18:02:40 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4: 	/opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema/provider.go:267 +0x91
2017/08/04 18:02:40 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/plugin.(*ResourceProviderServer).Refresh(0xc42032e000, 0xc42049e020, 0xc42049eae0, 0x0, 0x0)
2017/08/04 18:02:40 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4: 	/opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/plugin/resource_provider.go:510 +0x4e
2017/08/04 18:02:40 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4: reflect.Value.call(0xc4203dae40, 0xc420112040, 0x13, 0x2076d90, 0x4, 0xc42022df20, 0x3, 0x3, 0x0, 0xc4206b0a20, ...)
2017/08/04 18:02:40 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4: 	/usr/local/go/src/reflect/value.go:434 +0x91f
2017/08/04 18:02:40 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4: reflect.Value.Call(0xc4203dae40, 0xc420112040, 0x13, 0xc420036f20, 0x3, 0x3, 0xc4202335c0, 0x33ae340, 0xc4202337a0)
2017/08/04 18:02:40 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4: 	/usr/local/go/src/reflect/value.go:302 +0xa4
2017/08/04 18:02:40 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4: net/rpc.(*service).call(0xc42041a140, 0xc42041a100, 0xc4203fa180, 0xc42026a700, 0xc4202609a0, 0x1a48ac0, 0xc42049e020, 0x16, 0x1a48b00, 0xc42049eae0, ...)
2017/08/04 18:02:40 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4: 	/usr/local/go/src/net/rpc/server.go:387 +0x144
2017/08/04 18:02:40 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4: created by net/rpc.(*Server).ServeCodec
2017/08/04 18:02:40 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4: 	/usr/local/go/src/net/rpc/server.go:481 +0x404
2017/08/04 18:02:40 [ERROR] root: eval: *terraform.EvalRefresh, err: aws_vpc.vpc: unexpected EOF
2017/08/04 18:02:40 [ERROR] root: eval: *terraform.EvalRefresh, err: aws_s3_bucket.bucket: unexpected EOF
2017/08/04 18:02:40 [ERROR] root: eval: *terraform.EvalSequence, err: aws_vpc.vpc: unexpected EOF
2017/08/04 18:02:40 [ERROR] root: eval: *terraform.EvalSequence, err: aws_s3_bucket.bucket: unexpected EOF

@opalmer
Copy link

opalmer commented Aug 4, 2017

So to try and figure this out, I did the following:

mkdir -p ~/go/src/github.com/terraform-providers/
cd ~/go/src/github.com/terraform-providers/
git clone https://github.com/terraform-providers/terraform-provider-aws/
make build
cd <location of templates>
rm .terraform/plugins/linux_amd64/terraform-provider-aws_v0.1.3_x4
ln -s ~/go/bin/terraform-provider-aws .terraform/plugins/linux_amd64/terraform-provider-aws_v0.1.3_x4
terraform init
terraform plan

And it works. I guess the change I referenced above, which fixes hashicorp/terraform#15706, is not deployed yet? I'm unfamiliar with Terraform's plugin infrastructure still so I'm not sure if the above is a reasonable work around and if it's actually pointing out that the problem is fixed just not 'deployed'.

@joshuaspence
Copy link
Contributor

#1316 has been merged but you won't see the fix until the next version of the AWS provider is released (version 0.1.4).

@hylaride
Copy link
Author

hylaride commented Aug 5, 2017

@joshuaspence do you know when that release will be?

@joshuaspence
Copy link
Contributor

I don't, sorry. That would be a question for one of the maintainers.

@radeksimko
Copy link
Member

radeksimko commented Aug 5, 2017

Hi @hylaride,
thanks for the report.

I will mark this as duplicate of #1314 which was fixed in #1316 and will be shipped as part of the next release 🔜 .

@radeksimko
Copy link
Member

Duplicate of #1314

@radeksimko radeksimko marked this as a duplicate of #1314 Aug 5, 2017
@ghost
Copy link

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

No branches or pull requests

4 participants