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

Enable all metadata-options to be enabled regardless of http_endpoint setting for EC2 Launch Template #30107

Merged
merged 6 commits into from Mar 29, 2023

Conversation

wzzzrd86
Copy link
Contributor

@wzzzrd86 wzzzrd86 commented Mar 17, 2023

Description

This change will allow the options instance_metadata_tags, http_tokens, and http_put_request to be set in the aws_launch_template resource without the option http_endpoint being set to enabled.

Currently, if you set any of the 3 options above you will without http_endpoint you will see the following warning where the values are set to ""

  • .metadata_options[0].http_put_response_hop_limit: was cty.NumberIntVal(10), but now cty.NumberIntVal(0)
  • .metadata_options[0].http_tokens: was cty.StringVal("required"), but now cty.StringVal("")
  • .metadata_options[0].instance_metadata_tags: was cty.StringVal("enabled"), but now cty.StringVal("")

After reading the documentation I don't see that any of these values are dependent on http_endpoint.

Relations

Closes #29209
Closes #23174
Closes #25909
Closes #25836

References

Metadata options documentation from AWS

Output from Acceptance Testing

make testacc TESTS=TestAccEC2LaunchTemplate_metadataOptions

image

@github-actions
Copy link

Community Note

Voting for Prioritization

  • Please vote on this pull request by adding a 👍 reaction to the original post to help the community and maintainers prioritize this pull request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

For Submitters

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • For new resources and data sources, use skaff to generate scaffolding with comments detailing common expectations.
  • Whether or not the branch has been rebased will not impact prioritization, but doing so is always a welcome surprise.

@github-actions github-actions bot added needs-triage Waiting for first response or review from a maintainer. size/S Managed by automation to categorize the size of a PR. service/ec2 Issues and PRs that pertain to the ec2 service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Mar 17, 2023
@justinretzolk justinretzolk added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Mar 17, 2023
@breathingdust breathingdust changed the title Enable all metadata-options to be enabled regardless of http_endpoint setting for E2 Launch Template Enable all metadata-options to be enabled regardless of http_endpoint setting for EC2 Launch Template Mar 17, 2023
wzzzrd86 and others added 3 commits March 17, 2023 15:35
@johnsonaj johnsonaj self-assigned this Mar 29, 2023
Copy link
Contributor

@johnsonaj johnsonaj left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

$ make testacc PKG=ec2 TESTS="TestAccEC2LaunchTemplate_"

==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/ec2/... -v -count 1 -parallel 20 -run='TestAccEC2LaunchTemplate_'  -timeout 180m
--- PASS: TestAccEC2LaunchTemplate_basic (34.68s)
--- PASS: TestAccEC2LaunchTemplate_instanceRequirements_spotMaxPricePercentageOverLowestPrice (39.07s)
--- PASS: TestAccEC2LaunchTemplate_licenseSpecification (40.40s)
--- PASS: TestAccEC2LaunchTemplate_Placement_partitionNum (55.70s)
--- PASS: TestAccEC2LaunchTemplate_instanceRequirements_cpuManufacturers (67.21s)
--- PASS: TestAccEC2LaunchTemplate_instanceRequirements_acceleratorNames (67.79s)
--- PASS: TestAccEC2LaunchTemplate_instanceRequirements_excludedInstanceTypes (67.80s)
--- PASS: TestAccEC2LaunchTemplate_instanceRequirements_instanceGenerations (68.03s)
--- PASS: TestAccEC2LaunchTemplate_instanceRequirements_memoryMiBAndVCPUCount (68.67s)
--- PASS: TestAccEC2LaunchTemplate_instanceRequirements_acceleratorManufacturers (68.80s)
--- PASS: TestAccEC2LaunchTemplate_instanceRequirements_onDemandMaxPricePercentageOverLowestPrice (33.21s)
--- PASS: TestAccEC2LaunchTemplate_hibernation (73.70s)
--- PASS: TestAccEC2LaunchTemplate_defaultVersion (73.89s)
--- PASS: TestAccEC2LaunchTemplate_enclaveOptions (74.36s)
--- PASS: TestAccEC2LaunchTemplate_NetworkInterface_ipv6AddressCount (32.19s)
--- PASS: TestAccEC2LaunchTemplate_instanceRequirements_acceleratorCount (96.59s)
--- PASS: TestAccEC2LaunchTemplate_instanceRequirements_totalLocalStorageGB (97.95s)
--- PASS: TestAccEC2LaunchTemplate_instanceRequirements_baselineEBSBandwidthMbps (98.62s)
--- PASS: TestAccEC2LaunchTemplate_instanceRequirements_networkBandwidthGbps (99.54s)
--- PASS: TestAccEC2LaunchTemplate_updateDefaultVersion (99.58s)
--- PASS: TestAccEC2LaunchTemplate_NetworkInterface_ipv6Addresses (31.87s)
--- PASS: TestAccEC2LaunchTemplate_instanceRequirements_acceleratorTotalMemoryMiB (99.79s)
--- PASS: TestAccEC2LaunchTemplate_instanceRequirements_requireHibernateSupport (65.17s)
--- PASS: TestAccEC2LaunchTemplate_privateDNSNameOptions (31.16s)
--- PASS: TestAccEC2LaunchTemplate_metadataOptions (108.91s)
--- PASS: TestAccEC2LaunchTemplate_CreditSpecification_nonBurstable (32.68s)
--- PASS: TestAccEC2LaunchTemplate_Placement_hostResourceGroupARN (34.76s)
--- PASS: TestAccEC2LaunchTemplate_instanceRequirements_localStorageTypes (63.57s)
--- PASS: TestAccEC2LaunchTemplate_networkInterfaceIPv6PrefixCount (32.08s)
--- PASS: TestAccEC2LaunchTemplate_networkInterfaceCardIndex (31.96s)
--- PASS: TestAccEC2LaunchTemplate_networkInterfaceIPv4PrefixCount (32.30s)
--- PASS: TestAccEC2LaunchTemplate_networkInterfaceIPv4Prefixes (32.63s)
--- PASS: TestAccEC2LaunchTemplate_networkInterfaceIPv6Prefixes (33.47s)
--- PASS: TestAccEC2LaunchTemplate_networkInterfaceType (31.87s)
--- PASS: TestAccEC2LaunchTemplate_instanceRequirements_acceleratorTypes (63.28s)
--- PASS: TestAccEC2LaunchTemplate_instanceRequirements_allowedInstanceTypes (64.74s)
--- PASS: TestAccEC2LaunchTemplate_networkInterfaceAddresses (37.91s)
--- PASS: TestAccEC2LaunchTemplate_instanceMarketOptions (83.89s)
--- PASS: TestAccEC2LaunchTemplate_cpuOptions (25.47s)
--- PASS: TestAccEC2LaunchTemplate_IAMInstanceProfile_emptyBlock (35.16s)
--- PASS: TestAccEC2LaunchTemplate_networkInterface (50.38s)
--- PASS: TestAccEC2LaunchTemplate_CapacityReservation_preference (37.53s)
--- PASS: TestAccEC2LaunchTemplate_instanceRequirements_burstablePerformance (105.88s)
--- PASS: TestAccEC2LaunchTemplate_instanceRequirements_localStorage (105.14s)
--- PASS: TestAccEC2LaunchTemplate_instanceRequirements_memoryGiBPerVCPU (105.28s)
--- PASS: TestAccEC2LaunchTemplate_instanceRequirements_networkInterfaceCount (133.58s)
--- PASS: TestAccEC2LaunchTemplate_CreditSpecification_t4g (42.58s)
--- PASS: TestAccEC2LaunchTemplate_CreditSpecification_t3 (42.65s)
--- PASS: TestAccEC2LaunchTemplate_CreditSpecification_t2 (44.33s)
--- PASS: TestAccEC2LaunchTemplate_CapacityReservation_target (43.73s)
--- PASS: TestAccEC2LaunchTemplate_instanceRequirements_bareMetal (103.45s)
--- PASS: TestAccEC2LaunchTemplate_data (38.03s)
--- PASS: TestAccEC2LaunchTemplate_disappears (16.50s)
--- PASS: TestAccEC2LaunchTemplate_associateCarrierIPAddress (94.45s)
--- PASS: TestAccEC2LaunchTemplate_Name_prefix (22.35s)
--- PASS: TestAccEC2LaunchTemplate_Name_generated (22.86s)
--- PASS: TestAccEC2LaunchTemplate_description (51.55s)
--- PASS: TestAccEC2LaunchTemplate_elasticInferenceAccelerator (35.92s)
--- PASS: TestAccEC2LaunchTemplate_tags (65.94s)
--- PASS: TestAccEC2LaunchTemplate_NetworkInterfaces_deleteOnTermination (76.53s)
--- PASS: TestAccEC2LaunchTemplate_update (70.86s)
--- PASS: TestAccEC2LaunchTemplate_BlockDeviceMappingsEBS_deleteOnTermination (58.71s)
--- PASS: TestAccEC2LaunchTemplate_BlockDeviceMappingsEBS_gp3 (44.09s)
--- PASS: TestAccEC2LaunchTemplate_BlockDeviceMappings_ebs (44.89s)
--- PASS: TestAccEC2LaunchTemplate_ebsOptimized (60.52s)
--- PASS: TestAccEC2LaunchTemplate_associatePublicIPAddress (252.18s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/ec2	354.145s

@johnsonaj
Copy link
Contributor

@wzzzrd86 thanks for the contribution! 🎉

@johnsonaj johnsonaj merged commit d02edbd into hashicorp:main Mar 29, 2023
38 checks passed
@github-actions github-actions bot added this to the v4.61.0 milestone Mar 29, 2023
@github-actions
Copy link

This functionality has been released in v4.61.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!

@tburow
Copy link

tburow commented Mar 31, 2023

ok - this changed the default metadata options from whats set in the documentation. This is a BREAKING CHANGE

4.61.0 release changes the default setting from optional to required.

http_tokens - (Optional) Whether or not the metadata service requires session tokens, also referred to as Instance Metadata Service Version 2 (IMDSv2). Can be "optional" or "required". (Default: "optional").

If this is intentional - it is not reflected in the release notes or 4.61.0 documentation.

@github-actions
Copy link

github-actions bot commented May 1, 2023

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.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 1, 2023
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/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
4 participants