[Bug]: Configuration block metadata_options of launch_template is not granular enough #29985
Labels
bug
Addresses a defect in current functionality.
service/ec2
Issues and PRs that pertain to the ec2 service.
Terraform Core Version
1.1.9
AWS Provider Version
4.58.0
Affected Resource(s)
aws_launch_template
Expected Behavior
Configuration options of
launch_template
are consistent with aws api in terms how independent they are. Setting/updating one is not forcing setting/updating of other.Actual Behavior
Options in
metadata_options
block are not consistent with aws api. As an example, setting a value ofhttp_endpoint
also forces to set a value forinstance_metadata_tags
Relevant Error/Panic Output Snippet
No response
Terraform Configuration Files
Start with tf config below and continue with reproduction steps.
Steps to Reproduce
"metadata_options": [],
aws ec2 describe-launch-template-versions ...
returns"LaunchTemplateData": { "UserData": "" }
metadata_options
using aws apiaws ec2 create-launch-template-version --launch-template-id <id> --launch-template-data '{"MetadataOptions": {"HttpEndpoint": "disabled"}}'
aws ec2 describe-launch-template-versions ...
returns output below. Thus it is perfectly ok to do this as far as aws is concernedHere aws provider is adding two more options. They were not configured in tf source. They are not set on real resource. Aws api does not require this to be set. When editing a template in aws console, ui has drop down with three values for each setting:
enabled
,disabled
,do not include in template
.Is there any reason why aws provider enforces this? There are two issues with this:
http_protocol
but leavesinstance_metadata_tags
undefined for example. Provider does not support this atm.When we encountered this
We use old version of aws provider (
3.70.0
) in production which we need to update due to other issues.3.70.0
does not havemetadata_options.instance_metadata_tags
at all. Updating to4.58.0
adds this value to state. But instead of using null or empty value it sets it todisabled
. This creates new version of a template which in turn triggers eks node group update. We cannot justify rotation of production nodes by this so we are kinda blocked by this.Debug Output
No response
Panic Output
No response
Important Factoids
We have searched through bug reports. There are couple of those related to
launch_template.metadata_options
. However none of them seems to cover this particular issue.References
No response
Would you like to implement a fix?
None
The text was updated successfully, but these errors were encountered: