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

datasource/aws_kms_alias: panic: runtime error: invalid memory address or nil pointer dereference #3189

Closed
ColinHebert opened this issue Jan 30, 2018 · 6 comments
Labels
bug Addresses a defect in current functionality. crash Results from or addresses a Terraform crash or kernel panic. service/kms Issues and PRs that pertain to the kms service.
Milestone

Comments

@ColinHebert
Copy link
Contributor

Using the version 1.8.0 of the provider we're hitting this message:


panic: runtime error: invalid memory address or nil pointer dereference
2018-01-30T05:17:27.715Z [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4: [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x19ca443]
2018-01-30T05:17:27.715Z [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4: 
2018-01-30T05:17:27.715Z [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4: goroutine 4052 [running]:
2018-01-30T05:17:27.715Z [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4: github.com/terraform-providers/terraform-provider-aws/aws.dataSourceAwsKmsAliasRead(0xc42032c230, 0x24fd280, 0xc420ba9180, 0xc42032c230, 0x0)
2018-01-30T05:17:27.715Z [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4: 	/opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-aws/aws/data_source_aws_kms_alias.go:76 +0x3b3
2018-01-30T05:17:27.715Z [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema.(*Resource).ReadDataApply(0xc42041ad20, 0xc420782140, 0x24fd280, 0xc420ba9180, 0xc42018f640, 0xc420970001, 0x80000000018)
2018-01-30T05:17:27.715Z [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4: 	/opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema/resource.go:292 +0x8b
2018-01-30T05:17:27.715Z [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema.(*Provider).ReadDataApply(0xc4206dcaf0, 0xc42045c640, 0xc420782140, 0x7fe589c73458, 0x0, 0x0)
2018-01-30T05:17:27.715Z [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4: 	/opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema/provider.go:426 +0x9a
2018-01-30T05:17:27.715Z [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/plugin.(*ResourceProviderServer).ReadDataApply(0xc420350780, 0xc42049a9d0, 0xc42049aa00, 0x0, 0x0)
2018-01-30T05:17:27.715Z [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4: 	/opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/plugin/resource_provider.go:604 +0x4e
2018-01-30T05:17:27.715Z [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4: reflect.Value.call(0xc4202925a0, 0xc4203be190, 0x13, 0x28f602e, 0x4, 0xc421095f20, 0x3, 0x3, 0xc4204cd728, 0x2, ...)
2018-01-30T05:17:27.715Z [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4: 	/usr/local/go/src/reflect/value.go:434 +0x905
2018-01-30T05:17:27.715Z [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4: reflect.Value.Call(0xc4202925a0, 0xc4203be190, 0x13, 0xc4204cd720, 0x3, 0x3, 0x43e5ec0, 0xc4204d88a0, 0xc4205b8000)
2018-01-30T05:17:27.715Z [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4: 	/usr/local/go/src/reflect/value.go:302 +0xa4
2018-01-30T05:17:27.715Z [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4: net/rpc.(*service).call(0xc420ae2300, 0xc420bd6910, 0xc4204b07f0, 0xc4201ca580, 0xc420bda800, 0x20722a0, 0xc42049a9d0, 0x16, 0x20722e0, 0xc42049aa00, ...)
2018-01-30T05:17:27.715Z [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4: 	/usr/local/go/src/net/rpc/server.go:381 +0x142
2018-01-30T05:17:27.715Z [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4: created by net/rpc.(*Server).ServeCodec
2018-01-30T05:17:27.715Z [DEBUG] plugin.terraform-provider-aws_v1.8.0_x4: 	/usr/local/go/src/net/rpc/server.go:475 +0x36b

It is very likely due to #2551 . In particular: https://github.com/terraform-providers/terraform-provider-aws/blob/v1.8.0/aws/data_source_aws_kms_alias.go#L76

cc @bflad, @radeksimko

@radeksimko radeksimko added bug Addresses a defect in current functionality. crash Results from or addresses a Terraform crash or kernel panic. service/kms Issues and PRs that pertain to the kms service. labels Jan 30, 2018
@xtimon
Copy link

xtimon commented Jan 30, 2018

I got the same error

@bflad
Copy link
Contributor

bflad commented Jan 30, 2018

I'm sorry for the trouble, looking at this now. Can someone describe a little more about the configuration of the affected KMS alias (e.g. is the target key ID actually empty somehow) or when you encountered this (e.g. creating new aliases)? Thanks so much.

@bflad bflad self-assigned this Jan 30, 2018
@bflad
Copy link
Contributor

bflad commented Jan 30, 2018

Ah ha -- found this in the KMS API documentation:

The response might include several aliases that do not have a TargetKeyId field because they are not associated with a CMK. These are predefined aliases that are reserved for CMKs managed by AWS services.

@bflad
Copy link
Contributor

bflad commented Jan 30, 2018

Fix PR submitted: #3203

@bflad bflad added this to the v1.9.0 milestone Jan 30, 2018
@bflad bflad removed their assignment Jan 30, 2018
@bflad
Copy link
Contributor

bflad commented Jan 31, 2018

The fix for this has been merged into master and will be released in v1.9.0 of the AWS provider.

@ghost
Copy link

ghost commented Apr 8, 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 8, 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/kms Issues and PRs that pertain to the kms service.
Projects
None yet
Development

No branches or pull requests

4 participants