-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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/launch_template: exclude associate_public_ip_address when not set #5314
Conversation
during some manual testing, found that |
The current implementation of
In the upcoming Terraform 0.12 release, we will however support |
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.
Thanks for submitting this @kl4w! 👍 As noted below, I think this restricting functionality we should support. We can use conditional logic to nil
out erroneous API parameters if necessary.
aws/resource_aws_launch_template.go
Outdated
DeleteOnTermination: aws.Bool(ni["delete_on_termination"].(bool)), | ||
networkInterface := &ec2.LaunchTemplateInstanceNetworkInterfaceSpecificationRequest{} | ||
|
||
if v, ok := ni["associate_public_ip_address"]; ok && v.(bool) { |
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.
I believe setting false
should be a valid value (at least it is in the EC2 console from the options of don't set / disable / enable) -- I think we need to cover both cases of ignoring this attribute when network_interface_id
is set, as well as allowing false
.
aws/resource_aws_launch_template.go
Outdated
networkInterface.AssociatePublicIpAddress = aws.Bool(v.(bool)) | ||
} | ||
|
||
if v, ok := ni["delete_on_termination"]; ok && v.(bool) { |
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.
Same here -- I believe setting false
should be a valid value (at least it is in the EC2 console from the options of don't set / off / on).
@bflad made changes as requested, output of tests:
|
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.
Looks good, thanks @kl4w! 🚀
9 tests passed (all tests)
=== RUN TestAccAWSLaunchTemplate_data
--- PASS: TestAccAWSLaunchTemplate_data (7.01s)
=== RUN TestAccAWSLaunchTemplate_nonBurstable
--- PASS: TestAccAWSLaunchTemplate_nonBurstable (7.19s)
=== RUN TestAccAWSLaunchTemplate_basic
--- PASS: TestAccAWSLaunchTemplate_basic (7.85s)
=== RUN TestAccAWSLaunchTemplate_importData
--- PASS: TestAccAWSLaunchTemplate_importData (8.19s)
=== RUN TestAccAWSLaunchTemplate_importBasic
--- PASS: TestAccAWSLaunchTemplate_importBasic (8.51s)
=== RUN TestAccAWSLaunchTemplate_BlockDeviceMappings_EBS
--- PASS: TestAccAWSLaunchTemplate_BlockDeviceMappings_EBS (9.07s)
=== RUN TestAccAWSLaunchTemplate_networkInterface
--- PASS: TestAccAWSLaunchTemplate_networkInterface (10.13s)
=== RUN TestAccAWSLaunchTemplate_update
--- PASS: TestAccAWSLaunchTemplate_update (12.31s)
=== RUN TestAccAWSLaunchTemplate_tags
--- PASS: TestAccAWSLaunchTemplate_tags (13.15s)
This has been released in version 1.30.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. |
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! |
Fixes #5293
Changes proposed in this pull request:
Output from acceptance testing: