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

Add a nil check for reading instance market options #8844

Merged
merged 1 commit into from
Jun 4, 2019
Merged

Conversation

ryndaniels
Copy link
Contributor

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" comments, they generate extra noise for pull request followers and do not help prioritize the request

Fixes #7885

Release note for CHANGELOG:

BUG FIXES:
* resource/aws_launch_template: Add a nil check for `spot_options` to
avoiding panicking if options are empty

Output from acceptance testing:

make testacc TESTARGS="-run=TestAccAWSLaunchTemplate"  
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./... -v -parallel 20 -run=TestAccAWSLaunchTemplate -timeout 120m
?       github.com/terraform-providers/terraform-provider-aws   [no test files]
=== RUN   TestAccAWSLaunchTemplateDataSource_basic
=== PAUSE TestAccAWSLaunchTemplateDataSource_basic
=== RUN   TestAccAWSLaunchTemplate_importBasic
=== PAUSE TestAccAWSLaunchTemplate_importBasic
=== RUN   TestAccAWSLaunchTemplate_importData
=== PAUSE TestAccAWSLaunchTemplate_importData
=== RUN   TestAccAWSLaunchTemplate_basic
=== PAUSE TestAccAWSLaunchTemplate_basic
=== RUN   TestAccAWSLaunchTemplate_disappears
=== PAUSE TestAccAWSLaunchTemplate_disappears
=== RUN   TestAccAWSLaunchTemplate_BlockDeviceMappings_EBS
=== PAUSE TestAccAWSLaunchTemplate_BlockDeviceMappings_EBS
=== RUN   TestAccAWSLaunchTemplate_BlockDeviceMappings_EBS_DeleteOnTermination
=== PAUSE TestAccAWSLaunchTemplate_BlockDeviceMappings_EBS_DeleteOnTermination
=== RUN   TestAccAWSLaunchTemplate_EbsOptimized
=== PAUSE TestAccAWSLaunchTemplate_EbsOptimized
=== RUN   TestAccAWSLaunchTemplate_ElasticInferenceAccelerator
=== PAUSE TestAccAWSLaunchTemplate_ElasticInferenceAccelerator
=== RUN   TestAccAWSLaunchTemplate_data
=== PAUSE TestAccAWSLaunchTemplate_data
=== RUN   TestAccAWSLaunchTemplate_description
=== PAUSE TestAccAWSLaunchTemplate_description
=== RUN   TestAccAWSLaunchTemplate_update
=== PAUSE TestAccAWSLaunchTemplate_update
=== RUN   TestAccAWSLaunchTemplate_tags
=== PAUSE TestAccAWSLaunchTemplate_tags
=== RUN   TestAccAWSLaunchTemplate_capacityReservation_preference
=== PAUSE TestAccAWSLaunchTemplate_capacityReservation_preference
=== RUN   TestAccAWSLaunchTemplate_capacityReservation_target
=== PAUSE TestAccAWSLaunchTemplate_capacityReservation_target
=== RUN   TestAccAWSLaunchTemplate_creditSpecification_nonBurstable
=== PAUSE TestAccAWSLaunchTemplate_creditSpecification_nonBurstable
=== RUN   TestAccAWSLaunchTemplate_creditSpecification_t2
=== PAUSE TestAccAWSLaunchTemplate_creditSpecification_t2
=== RUN   TestAccAWSLaunchTemplate_creditSpecification_t3
=== PAUSE TestAccAWSLaunchTemplate_creditSpecification_t3
=== RUN   TestAccAWSLaunchTemplate_IamInstanceProfile_EmptyConfigurationBlock
=== PAUSE TestAccAWSLaunchTemplate_IamInstanceProfile_EmptyConfigurationBlock
=== RUN   TestAccAWSLaunchTemplate_networkInterface
=== PAUSE TestAccAWSLaunchTemplate_networkInterface
=== RUN   TestAccAWSLaunchTemplate_networkInterface_ipv6Addresses
=== PAUSE TestAccAWSLaunchTemplate_networkInterface_ipv6Addresses
=== RUN   TestAccAWSLaunchTemplate_networkInterface_ipv6AddressCount
=== PAUSE TestAccAWSLaunchTemplate_networkInterface_ipv6AddressCount
=== RUN   TestAccAWSLaunchTemplate_instanceMarketOptions
=== PAUSE TestAccAWSLaunchTemplate_instanceMarketOptions
=== RUN   TestAccAWSLaunchTemplate_licenseSpecification
=== PAUSE TestAccAWSLaunchTemplate_licenseSpecification
=== CONT  TestAccAWSLaunchTemplateDataSource_basic
=== CONT  TestAccAWSLaunchTemplate_networkInterface_ipv6AddressCount
=== CONT  TestAccAWSLaunchTemplate_EbsOptimized
=== CONT  TestAccAWSLaunchTemplate_BlockDeviceMappings_EBS
=== CONT  TestAccAWSLaunchTemplate_licenseSpecification
=== CONT  TestAccAWSLaunchTemplate_instanceMarketOptions
=== CONT  TestAccAWSLaunchTemplate_disappears
=== CONT  TestAccAWSLaunchTemplate_basic
=== CONT  TestAccAWSLaunchTemplate_importData
=== CONT  TestAccAWSLaunchTemplate_BlockDeviceMappings_EBS_DeleteOnTermination
=== CONT  TestAccAWSLaunchTemplate_update
=== CONT  TestAccAWSLaunchTemplate_description
=== CONT  TestAccAWSLaunchTemplate_data
=== CONT  TestAccAWSLaunchTemplate_ElasticInferenceAccelerator
=== CONT  TestAccAWSLaunchTemplate_creditSpecification_t2
=== CONT  TestAccAWSLaunchTemplate_importBasic
=== CONT  TestAccAWSLaunchTemplate_creditSpecification_nonBurstable
=== CONT  TestAccAWSLaunchTemplate_capacityReservation_target
=== CONT  TestAccAWSLaunchTemplate_capacityReservation_preference
=== CONT  TestAccAWSLaunchTemplate_tags
--- PASS: TestAccAWSLaunchTemplate_disappears (20.54s)
=== CONT  TestAccAWSLaunchTemplate_creditSpecification_t3
--- PASS: TestAccAWSLaunchTemplate_networkInterface_ipv6AddressCount (24.22s)
=== CONT  TestAccAWSLaunchTemplate_networkInterface_ipv6Addresses
--- PASS: TestAccAWSLaunchTemplate_capacityReservation_preference (24.30s)
=== CONT  TestAccAWSLaunchTemplate_networkInterface
--- PASS: TestAccAWSLaunchTemplate_creditSpecification_nonBurstable (24.34s)
=== CONT  TestAccAWSLaunchTemplate_IamInstanceProfile_EmptyConfigurationBlock
--- PASS: TestAccAWSLaunchTemplate_creditSpecification_t2 (24.63s)
--- PASS: TestAccAWSLaunchTemplate_data (24.67s)
--- PASS: TestAccAWSLaunchTemplate_basic (25.29s)
--- PASS: TestAccAWSLaunchTemplate_importData (27.14s)
--- PASS: TestAccAWSLaunchTemplate_licenseSpecification (28.44s)
--- PASS: TestAccAWSLaunchTemplate_importBasic (29.65s)
--- PASS: TestAccAWSLaunchTemplateDataSource_basic (33.42s)
--- PASS: TestAccAWSLaunchTemplate_capacityReservation_target (36.05s)
--- PASS: TestAccAWSLaunchTemplate_description (42.21s)
--- PASS: TestAccAWSLaunchTemplate_creditSpecification_t3 (23.51s)
--- PASS: TestAccAWSLaunchTemplate_tags (44.05s)
--- PASS: TestAccAWSLaunchTemplate_ElasticInferenceAccelerator (45.57s)
--- PASS: TestAccAWSLaunchTemplate_IamInstanceProfile_EmptyConfigurationBlock (23.51s)
--- PASS: TestAccAWSLaunchTemplate_networkInterface_ipv6Addresses (24.83s)
--- PASS: TestAccAWSLaunchTemplate_BlockDeviceMappings_EBS (51.34s)
--- PASS: TestAccAWSLaunchTemplate_instanceMarketOptions (80.88s)
--- PASS: TestAccAWSLaunchTemplate_update (86.36s)
--- PASS: TestAccAWSLaunchTemplate_networkInterface (62.83s)
--- PASS: TestAccAWSLaunchTemplate_BlockDeviceMappings_EBS_DeleteOnTermination (91.77s)
--- PASS: TestAccAWSLaunchTemplate_EbsOptimized (104.22s)
PASS
ok      github.com/terraform-providers/terraform-provider-aws/aws       105.039s

@ghost ghost added service/ec2 Issues and PRs that pertain to the ec2 service. size/XS Managed by automation to categorize the size of a PR. labels Jun 3, 2019
@ryndaniels ryndaniels requested a review from bflad June 3, 2019 16:57
Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @ryndaniels 🚀 (This nil was being problematic with reproducing in the acceptance testing and we opted to time box the fix here.)

Output from acceptance testing:

--- PASS: TestAccAWSLaunchTemplate_disappears (11.65s)
--- PASS: TestAccAWSLaunchTemplate_creditSpecification_t2 (16.10s)
--- PASS: TestAccAWSLaunchTemplate_IamInstanceProfile_EmptyConfigurationBlock (17.17s)
--- PASS: TestAccAWSLaunchTemplate_creditSpecification_t3 (17.81s)
--- PASS: TestAccAWSLaunchTemplate_capacityReservation_preference (17.89s)
--- PASS: TestAccAWSLaunchTemplate_creditSpecification_nonBurstable (18.07s)
--- PASS: TestAccAWSLaunchTemplate_data (18.67s)
--- PASS: TestAccAWSLaunchTemplateDataSource_basic (18.79s)
--- PASS: TestAccAWSLaunchTemplate_basic (18.61s)
--- PASS: TestAccAWSLaunchTemplate_importData (20.35s)
--- PASS: TestAccAWSLaunchTemplate_importBasic (20.59s)
--- PASS: TestAccAWSLaunchTemplate_capacityReservation_target (20.55s)
--- PASS: TestAccAWSLaunchTemplate_networkInterface (21.52s)
--- PASS: TestAccAWSLaunchTemplate_networkInterface_ipv6Addresses (12.41s)
--- PASS: TestAccAWSLaunchTemplate_description (24.92s)
--- PASS: TestAccAWSLaunchTemplate_tags (25.28s)
--- PASS: TestAccAWSLaunchTemplate_ElasticInferenceAccelerator (25.38s)
--- PASS: TestAccAWSLaunchTemplate_networkInterface_ipv6AddressCount (9.71s)
--- PASS: TestAccAWSLaunchTemplate_EbsOptimized (40.67s)
--- PASS: TestAccAWSLaunchTemplate_BlockDeviceMappings_EBS_DeleteOnTermination (44.21s)
--- PASS: TestAccAWSLaunchTemplate_update (46.89s)
--- PASS: TestAccAWSLaunchTemplate_BlockDeviceMappings_EBS (47.77s)
--- PASS: TestAccAWSLaunchTemplate_instanceMarketOptions (48.43s)

@bflad bflad added the bug Addresses a defect in current functionality. label Jun 3, 2019
@bflad bflad added this to the v2.14.0 milestone Jun 3, 2019
@ryndaniels ryndaniels merged commit e5740fd into master Jun 4, 2019
@bflad
Copy link
Contributor

bflad commented Jun 7, 2019

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

@bflad bflad deleted the rfd-spot-nil branch June 7, 2019 12:25
@ghost
Copy link

ghost commented Nov 3, 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 3, 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. service/ec2 Issues and PRs that pertain to the ec2 service. size/XS Managed by automation to categorize the size of a PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

aws_launch_template - panic: interface conversion: interface {} is nil, not map[string]interface {}
2 participants