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

Crash during aws_lb_target_group import #2245

Closed
szczad opened this issue Nov 10, 2017 · 8 comments
Closed

Crash during aws_lb_target_group import #2245

szczad opened this issue Nov 10, 2017 · 8 comments
Labels
bug Addresses a defect in current functionality. crash Results from or addresses a Terraform crash or kernel panic.

Comments

@szczad
Copy link

szczad commented Nov 10, 2017

Terraform Version

  • Terraform v0.10.8
  • provider.aws: 1.2

Affected Resource(s)

  • aws_lb_target_group

Terraform Configuration Files

https://drive.google.com/file/d/1eed8P0Qt20fO_mRqxy6FilNOjullMRJ7/view?usp=sharing

Debug Output

https://drive.google.com/file/d/17hEfMFCXJNwfpMC48yOOVNtkCbBkYHdG/view?usp=sharing

Panic Output

https://drive.google.com/file/d/13aoT1Ca2XwDOBGNFaHCoRUuTH4uwt1cR/view?usp=sharing

Expected Behavior

Given resource should import its state smoothly

Actual Behavior

Terraform crashes with crash log not doin anything

Steps to Reproduce

  1. terraform import aws_lb_target_group.<resource> <ARN>

Important Factoids

Trying to import "network" type load balancer with TCP target group

@roman-vynar
Copy link

I have got the same but on the creation step.
The problem is aws_lb_target_group resource expects either HTTP or HTTPS for network balancer which is a bug :( TCP should be there too.

Error: module.vpc.aws_lb_target_group.foo: "protocol" must be either "HTTP" or "HTTPS"

@roman-vynar
Copy link

So it turns out a network lb feature is completely unusable with terraform as you can't create TCP target group.

@radeksimko radeksimko added bug Addresses a defect in current functionality. crash Results from or addresses a Terraform crash or kernel panic. labels Nov 14, 2017
@radeksimko
Copy link
Member

Clipping out the relevant part of the crash log:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x194eed1]

goroutine 14 [running]:
github.com/terraform-providers/terraform-provider-aws/aws.flattenAwsLbTargetGroupResource(0xc420242380, 0x209a300, 0xc420090480, 0xc42037c3f0, 0x0, 0x7f8869124de8)
	/opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_lb_target_group.go:491 +0x391
github.com/terraform-providers/terraform-provider-aws/aws.resourceAwsLbTargetGroupRead(0xc420242380, 0x209a300, 0xc420090480, 0x0, 0x3b0d980)
	/opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_lb_target_group.go:257 +0x28b
github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema.(*Resource).Refresh(0xc42043b500, 0xc4208d80a0, 0x209a300, 0xc420090480, 0xc420450590, 0xc4202d9a01, 0x80000485772)
	/opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema/resource.go:321 +0x199
github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema.(*Provider).Refresh(0xc4202d6770, 0xc4208d8050, 0xc4208d80a0, 0x7f886917d000, 0x0, 0x18)
	/opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema/provider.go:308 +0x9a
github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/plugin.(*ResourceProviderServer).Refresh(0xc4202d2680, 0xc42046cba0, 0xc42046cd50, 0x0, 0x0)
	/opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/plugin/resource_provider.go:549 +0x4e
reflect.Value.call(0xc42047e060, 0xc4202e87b0, 0x13, 0x23e9987, 0x4, 0xc4202d9f20, 0x3, 0x3, 0x403a23, 0xc4204c2e00, ...)
	/usr/local/go/src/reflect/value.go:434 +0x906
reflect.Value.Call(0xc42047e060, 0xc4202e87b0, 0x13, 0xc4202a2f20, 0x3, 0x3, 0xc4202a2f20, 0xc4202a2f28, 0xc420603780)
	/usr/local/go/src/reflect/value.go:302 +0xa4
net/rpc.(*service).call(0xc4202c2900, 0xc42045e0a0, 0xc4202ee7b8, 0xc4203b4580, 0xc4202d3240, 0x1cda3c0, 0xc42046cba0, 0x16, 0x1cda400, 0xc42046cd50, ...)
	/usr/local/go/src/net/rpc/server.go:381 +0x142
created by net/rpc.(*Server).ServeCodec
	/usr/local/go/src/net/rpc/server.go:475 +0x36b

@catsby
Copy link
Contributor

catsby commented Nov 15, 2017

Hey @szczad thanks for the report, I'm looking into this now. I believe it's resolved with #2251 ; in that change we only set path for Application type load balancers, avoiding the nil pointer dereference. I'm trying to reproduce though to confirm, and I'm unable to decrypt the config zip you sent, what key did you use to encrypt it with?

Thanks!

@catsby
Copy link
Contributor

catsby commented Nov 15, 2017

I've verified aws_lb_listener, aws_lb_target_group, and aws_lb can all be imported after #2251, so I'm going to close this issue now. Thanks!

@catsby catsby closed this as completed Nov 15, 2017
@szczad
Copy link
Author

szczad commented Nov 16, 2017

@catsby Verified. I've built the plugin from master. Works like a charm right now.

PS: the key used here was taken from https://www.hashicorp.com/security - imported manually from gpg server with ID 51852D87348FFC4C

@catsby
Copy link
Contributor

catsby commented Nov 16, 2017

Ah yeah, that one 😄 I didn't have it installed, but I have since done so and verified I could decrypt your config, thanks again!

@ghost
Copy link

ghost commented Apr 10, 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 10, 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.
Projects
None yet
Development

No branches or pull requests

4 participants