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

Terraform0.12 with aws2.24 crashes during plan #9814

Closed
korjek opened this issue Aug 19, 2019 · 3 comments · Fixed by #9836
Closed

Terraform0.12 with aws2.24 crashes during plan #9814

korjek opened this issue Aug 19, 2019 · 3 comments · Fixed by #9836
Assignees
Labels
bug Addresses a defect in current functionality. crash Results from or addresses a Terraform crash or kernel panic. service/ec2 Issues and PRs that pertain to the ec2 service.
Milestone

Comments

@korjek
Copy link

korjek commented Aug 19, 2019

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

Terraform Version

Terraform version 0.12.6
aws provider version: 2.24

Terraform Configuration Files

https://www.dropbox.com/s/gmgneeyhvyyqn6a/gen.tf?dl=0
https://www.dropbox.com/s/u3rczydswur1fd2/spot_fleet_az.tf?dl=0

Panic Output

https://gist.github.com/korjek/c91a42f752175f50c152c0e1d2db8d05

Expected Behavior

Terraform should produce plan without crashing

Actual Behavior

Terrafrom keeps crashing

Steps to Reproduce

  1. terraform plan

Important Factoids

We don't have this issue with aws provider 2.16

@korjek korjek changed the title Terraform0.12 with aws2.24 crashed during plan Terraform0.12 with aws2.24 crashes during plan Aug 19, 2019
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Aug 19, 2019
@bflad bflad added bug Addresses a defect in current functionality. crash Results from or addresses a Terraform crash or kernel panic. service/ec2 Issues and PRs that pertain to the ec2 service. and removed needs-triage Waiting for first response or review from a maintainer. labels Aug 19, 2019
@bflad
Copy link
Contributor

bflad commented Aug 19, 2019

Relevant portion of the crash log:

2019/08/19 15:44:47 Instance store backed AMIs do not provide a root device name - Use an EBS AMI
panic: Instance store backed AMIs do not provide a root device name - Use an EBS AMI

goroutine 225 [running]:
log.Panic(0xc000c99890, 0x1, 0x1)
 /opt/goenv/versions/1.12.6/src/log/log.go:333 +0xac
github.com/terraform-providers/terraform-provider-aws/aws.launchSpecsToSet(0xc000c8ca90, 0x19, 0x19, 0xc0000ae330, 0xc000b47190)
 /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_spot_fleet_request.go:979 +0x13d
github.com/terraform-providers/terraform-provider-aws/aws.resourceAwsSpotFleetRequestRead(0xc000230070, 0x4963be0, 0xc0005d0000, 0xc000230070, 0x0)
 /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_spot_fleet_request.go:969 +0x4d9

Terraform resource code should never call panic() (or in this case log.Panic()) and instead should return a normal error to the operator.

This is related to #9775 as they share the same underlying function call to fetchRootDeviceName().

Definition of Done

Presumably, this must be done before fixes from #9775 are implemented so the error returns the unexpected crash.

  • Add covering test to aws/resource_aws_spot_fleet_request_test.go that triggers the current log.Panic()
  • Change the launchSpecsToSet function signature to include returning an error, e.g. launchSpecsToSet(launchSpecs []*ec2.SpotFleetLaunchSpecification, conn *ec2.EC2) (*schema.Set, error)
  • Switch implementation of return log.Panic(err) to return nil, err (and final return specSet to return specSet, nil)
  • Appropriately bubble up any returned errors from calls to launchSpecsToSet
  • Verify error is returned instead of panic

At this point, this crash issue can be closed out. The fixes from #9775 will fix the underlying implementation issue.

@aeschright aeschright self-assigned this Aug 19, 2019
@aeschright aeschright added this to the v2.29.0 milestone Sep 16, 2019
@ghost
Copy link

ghost commented Sep 20, 2019

This has been released in version 2.29.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks!

@ghost
Copy link

ghost commented Nov 1, 2019

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 Nov 1, 2019
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/ec2 Issues and PRs that pertain to the ec2 service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants