-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
r/aws_instance: launch_template Remove unnecessary api calls #20357
r/aws_instance: launch_template Remove unnecessary api calls #20357
Conversation
if diff.HasChange("launch_template.0.version") { | ||
_, ok := diff.GetOk("launch_template") | ||
|
||
if diff.Id() != "" && diff.HasChange("launch_template.0.version") && ok { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apparently HasChange
with an empty state will always return true when resource filed has Default
value, so I've added a check for top-level key.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🚀.
Commercial
% make testacc TEST=./aws TESTARGS='-run=TestAccAWSInstance_LaunchTemplate'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSInstance_LaunchTemplate -timeout 180m
=== RUN TestAccAWSInstance_LaunchTemplate_basic
=== PAUSE TestAccAWSInstance_LaunchTemplate_basic
=== RUN TestAccAWSInstance_LaunchTemplate_OverrideTemplate
=== PAUSE TestAccAWSInstance_LaunchTemplate_OverrideTemplate
=== RUN TestAccAWSInstance_LaunchTemplate_SetSpecificVersion
=== PAUSE TestAccAWSInstance_LaunchTemplate_SetSpecificVersion
=== RUN TestAccAWSInstance_LaunchTemplate_ModifyTemplate_DefaultVersion
=== PAUSE TestAccAWSInstance_LaunchTemplate_ModifyTemplate_DefaultVersion
=== RUN TestAccAWSInstance_LaunchTemplate_UpdateTemplateVersion
=== PAUSE TestAccAWSInstance_LaunchTemplate_UpdateTemplateVersion
=== RUN TestAccAWSInstance_LaunchTemplate_SwapIDAndName
=== PAUSE TestAccAWSInstance_LaunchTemplate_SwapIDAndName
=== CONT TestAccAWSInstance_LaunchTemplate_basic
=== CONT TestAccAWSInstance_LaunchTemplate_UpdateTemplateVersion
=== CONT TestAccAWSInstance_LaunchTemplate_ModifyTemplate_DefaultVersion
=== CONT TestAccAWSInstance_LaunchTemplate_SetSpecificVersion
=== CONT TestAccAWSInstance_LaunchTemplate_OverrideTemplate
=== CONT TestAccAWSInstance_LaunchTemplate_SwapIDAndName
--- PASS: TestAccAWSInstance_LaunchTemplate_basic (65.29s)
--- PASS: TestAccAWSInstance_LaunchTemplate_OverrideTemplate (108.64s)
--- PASS: TestAccAWSInstance_LaunchTemplate_SwapIDAndName (113.77s)
--- PASS: TestAccAWSInstance_LaunchTemplate_SetSpecificVersion (120.50s)
--- PASS: TestAccAWSInstance_LaunchTemplate_ModifyTemplate_DefaultVersion (123.63s)
--- PASS: TestAccAWSInstance_LaunchTemplate_UpdateTemplateVersion (219.89s)
PASS
ok github.com/terraform-providers/terraform-provider-aws/aws 223.009s
GovCloud
% make testacc TEST=./aws TESTARGS='-run=TestAccAWSInstance_LaunchTemplate'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSInstance_LaunchTemplate -timeout 180m
=== RUN TestAccAWSInstance_LaunchTemplate_basic
=== PAUSE TestAccAWSInstance_LaunchTemplate_basic
=== RUN TestAccAWSInstance_LaunchTemplate_OverrideTemplate
=== PAUSE TestAccAWSInstance_LaunchTemplate_OverrideTemplate
=== RUN TestAccAWSInstance_LaunchTemplate_SetSpecificVersion
=== PAUSE TestAccAWSInstance_LaunchTemplate_SetSpecificVersion
=== RUN TestAccAWSInstance_LaunchTemplate_ModifyTemplate_DefaultVersion
=== PAUSE TestAccAWSInstance_LaunchTemplate_ModifyTemplate_DefaultVersion
=== RUN TestAccAWSInstance_LaunchTemplate_UpdateTemplateVersion
=== PAUSE TestAccAWSInstance_LaunchTemplate_UpdateTemplateVersion
=== RUN TestAccAWSInstance_LaunchTemplate_SwapIDAndName
=== PAUSE TestAccAWSInstance_LaunchTemplate_SwapIDAndName
=== CONT TestAccAWSInstance_LaunchTemplate_basic
=== CONT TestAccAWSInstance_LaunchTemplate_UpdateTemplateVersion
=== CONT TestAccAWSInstance_LaunchTemplate_ModifyTemplate_DefaultVersion
=== CONT TestAccAWSInstance_LaunchTemplate_SwapIDAndName
=== CONT TestAccAWSInstance_LaunchTemplate_SetSpecificVersion
=== CONT TestAccAWSInstance_LaunchTemplate_OverrideTemplate
--- PASS: TestAccAWSInstance_LaunchTemplate_OverrideTemplate (70.70s)
--- PASS: TestAccAWSInstance_LaunchTemplate_basic (79.14s)
--- PASS: TestAccAWSInstance_LaunchTemplate_SwapIDAndName (125.26s)
--- PASS: TestAccAWSInstance_LaunchTemplate_SetSpecificVersion (134.76s)
--- PASS: TestAccAWSInstance_LaunchTemplate_ModifyTemplate_DefaultVersion (138.20s)
--- PASS: TestAccAWSInstance_LaunchTemplate_UpdateTemplateVersion (190.27s)
PASS
ok github.com/terraform-providers/terraform-provider-aws/aws 193.365s
@gordonbondon Thanks for the contribution 🎉 👏. |
This functionality has been released in v3.53.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. Thank you! |
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Community Note
My PR #10807 accidentally introduced two regressions related to instance usage when launch template does not yet exist, or was deleted. This PR addresses those two issues.
Closes #20331
Closes #20287
Output from acceptance testing: