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

resource/aws_launch_template: Prevent crashes with empty configuration blocks for top-level attributes #7134

Merged

Conversation

bflad
Copy link
Contributor

@bflad bflad commented Jan 14, 2019

Fixes #6757

Previous output from acceptance testing:

=== CONT  TestAccAWSLaunchTemplate_IamInstanceProfile_EmptyConfigurationBlock
panic: interface conversion: interface {} is nil, not map[string]interface {}

goroutine 186 [running]:
github.com/terraform-providers/terraform-provider-aws/aws.buildLaunchTemplateData(0xc0007d6b60, 0x48f2231, 0x4, 0x3dc1ec0)
	/Users/bflad/go/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_launch_template.go:1050 +0x267a
github.com/terraform-providers/terraform-provider-aws/aws.resourceAwsLaunchTemplateCreate(0xc0007d6b60, 0x42d8aa0, 0xc000b52700, 0xc0007d6b60, 0x0)
	/Users/bflad/go/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_launch_template.go:511 +0xcb

Output from acceptance testing:

--- PASS: TestAccAWSLaunchTemplate_basic (12.87s)
--- PASS: TestAccAWSLaunchTemplate_BlockDeviceMappings_EBS (49.76s)
--- PASS: TestAccAWSLaunchTemplate_BlockDeviceMappings_EBS_DeleteOnTermination (50.41s)
--- PASS: TestAccAWSLaunchTemplate_capacityReservation_preference (12.33s)
--- PASS: TestAccAWSLaunchTemplate_capacityReservation_target (18.20s)
--- PASS: TestAccAWSLaunchTemplate_creditSpecification_nonBurstable (12.19s)
--- PASS: TestAccAWSLaunchTemplate_creditSpecification_t2 (12.17s)
--- PASS: TestAccAWSLaunchTemplate_creditSpecification_t3 (12.48s)
--- PASS: TestAccAWSLaunchTemplate_data (12.55s)
--- PASS: TestAccAWSLaunchTemplate_disappears (9.73s)
--- PASS: TestAccAWSLaunchTemplate_EbsOptimized (46.99s)
--- PASS: TestAccAWSLaunchTemplate_IamInstanceProfile_EmptyConfigurationBlock (12.18s)
--- PASS: TestAccAWSLaunchTemplate_importBasic (13.97s)
--- PASS: TestAccAWSLaunchTemplate_importData (13.56s)
--- PASS: TestAccAWSLaunchTemplate_instanceMarketOptions (49.17s)
--- PASS: TestAccAWSLaunchTemplate_licenseSpecification (14.21s)
--- PASS: TestAccAWSLaunchTemplate_networkInterface (31.96s)
--- PASS: TestAccAWSLaunchTemplate_networkInterface_ipv6AddressCount (12.38s)
--- PASS: TestAccAWSLaunchTemplate_networkInterface_ipv6Addresses (12.41s)
--- PASS: TestAccAWSLaunchTemplate_tags (21.92s)
--- PASS: TestAccAWSLaunchTemplate_update (56.76s)

…n blocks for top-level attributes

Reference: #6757

Previous output from acceptance testing:

```
=== CONT  TestAccAWSLaunchTemplate_IamInstanceProfile_EmptyConfigurationBlock
panic: interface conversion: interface {} is nil, not map[string]interface {}

goroutine 186 [running]:
github.com/terraform-providers/terraform-provider-aws/aws.buildLaunchTemplateData(0xc0007d6b60, 0x48f2231, 0x4, 0x3dc1ec0)
	/Users/bflad/go/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_launch_template.go:1050 +0x267a
github.com/terraform-providers/terraform-provider-aws/aws.resourceAwsLaunchTemplateCreate(0xc0007d6b60, 0x42d8aa0, 0xc000b52700, 0xc0007d6b60, 0x0)
	/Users/bflad/go/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_launch_template.go:511 +0xcb
```

Output from acceptance testing:

```
--- PASS: TestAccAWSLaunchTemplate_basic (12.87s)
--- PASS: TestAccAWSLaunchTemplate_BlockDeviceMappings_EBS (49.76s)
--- PASS: TestAccAWSLaunchTemplate_BlockDeviceMappings_EBS_DeleteOnTermination (50.41s)
--- PASS: TestAccAWSLaunchTemplate_capacityReservation_preference (12.33s)
--- PASS: TestAccAWSLaunchTemplate_capacityReservation_target (18.20s)
--- PASS: TestAccAWSLaunchTemplate_creditSpecification_nonBurstable (12.19s)
--- PASS: TestAccAWSLaunchTemplate_creditSpecification_t2 (12.17s)
--- PASS: TestAccAWSLaunchTemplate_creditSpecification_t3 (12.48s)
--- PASS: TestAccAWSLaunchTemplate_data (12.55s)
--- PASS: TestAccAWSLaunchTemplate_disappears (9.73s)
--- PASS: TestAccAWSLaunchTemplate_EbsOptimized (46.99s)
--- PASS: TestAccAWSLaunchTemplate_IamInstanceProfile_EmptyConfigurationBlock (12.18s)
--- PASS: TestAccAWSLaunchTemplate_importBasic (13.97s)
--- PASS: TestAccAWSLaunchTemplate_importData (13.56s)
--- PASS: TestAccAWSLaunchTemplate_instanceMarketOptions (49.17s)
--- PASS: TestAccAWSLaunchTemplate_licenseSpecification (14.21s)
--- PASS: TestAccAWSLaunchTemplate_networkInterface (31.96s)
--- PASS: TestAccAWSLaunchTemplate_networkInterface_ipv6AddressCount (12.38s)
--- PASS: TestAccAWSLaunchTemplate_networkInterface_ipv6Addresses (12.41s)
--- PASS: TestAccAWSLaunchTemplate_tags (21.92s)
--- PASS: TestAccAWSLaunchTemplate_update (56.76s)
```
@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. labels Jan 14, 2019
@bflad bflad requested a review from a team January 14, 2019 14:36
@ghost ghost added tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. size/S Managed by automation to categorize the size of a PR. labels Jan 14, 2019
@bflad bflad added this to the v1.56.0 milestone Jan 14, 2019
Copy link
Contributor

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@bflad bflad merged commit 55cf9b1 into master Jan 14, 2019
@bflad bflad deleted the b-aws_launch_template-empty-configuration-block-panics branch January 14, 2019 17:25
bflad added a commit that referenced this pull request Jan 14, 2019
@bflad
Copy link
Contributor Author

bflad commented Jan 16, 2019

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

@ghost
Copy link

ghost commented Apr 1, 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 1, 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/ec2 Issues and PRs that pertain to the ec2 service. size/S Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

resource/aws_launch_template: Getting "unexpected EOF" and "connection is shut down" when applying
2 participants