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

aws_launch_template not configuring metadata_options #25909

Closed
phzietsman opened this issue Jul 21, 2022 · 11 comments · Fixed by #30107
Closed

aws_launch_template not configuring metadata_options #25909

phzietsman opened this issue Jul 21, 2022 · 11 comments · Fixed by #30107
Labels
bug Addresses a defect in current functionality. service/ec2 Issues and PRs that pertain to the ec2 service.
Milestone

Comments

@phzietsman
Copy link
Contributor

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • 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
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform CLI and Terraform AWS Provider Version

$ terraform -v
Terraform v0.14.11
+ provider registry.terraform.io/hashicorp/aws v4.22.0
+ provider registry.terraform.io/hashicorp/helm v2.6.0
+ provider registry.terraform.io/hashicorp/kubernetes v2.12.1
+ provider registry.terraform.io/hashicorp/template v2.2.0
+ provider registry.terraform.io/hashicorp/tls v3.4.0

Your version of Terraform is out of date! The latest version
is 1.2.5. You can update by downloading from https://www.terraform.io/downloads.html

Affected Resource(s)

  • aws_launch_template

Terraform Configuration Files

resource "aws_launch_template" "node_group_launch_template" {
  for_each               = var.eks_node_subnet_map
  name                   = "${local.cluster_base_name}-${each.key}-lt"
  user_data              = data.template_cloudinit_config.cluster_node_group_user_data.rendered
  key_name               = aws_key_pair.node_group_key_pair.key_name
  vpc_security_group_ids = [aws_security_group.cluster_sg.id]
  update_default_version = true

  block_device_mappings {
    device_name = "/dev/xvda"
    ebs {
      delete_on_termination = "true"
      volume_size           = each.value["disk_size"]
      volume_type           = "gp2"
    }
  }

  metadata_options {
    http_tokens                 = "required"
    http_put_response_hop_limit = 2
    instance_metadata_tags      = "disabled"
  }

  # lifecycle {
  #   ignore_changes = [metadata_options]
  # }

  tag_specifications {
    resource_type = "instance"
    tags          = local.deployment_tags
  }
}

Expected Behavior

The metadata options are set on the launch template after apply.

Actual Behavior

The metadata options are NOT set on the launch template after apply. On a new plan TF detects that options are not set and want to make the required changes, but it has not effect.

Steps to Reproduce

  1. terraform apply
@github-actions github-actions bot added needs-triage Waiting for first response or review from a maintainer. service/ec2 Issues and PRs that pertain to the ec2 service. labels Jul 21, 2022
@ewbankkit
Copy link
Contributor

Similar: #25896.

@bevanbennett
Copy link

To be more specific, it appears that aws_instance supports instance_metadata_tags as part of metadata_options, but aws_launch_configuration does not. This is a huge blocker for a project of ours.

@kruftmeister
Copy link

kruftmeister commented Aug 3, 2022

To be more specific, it appears that aws_instance supports instance_metadata_tags as part of metadata_options, but aws_launch_configuration does not. This is a huge blocker for a project of ours.

Launch Configuration != Launch Template, especially AWS phasing LC out in favour of LT.

@amille44420
Copy link

I confirm meeting such issue as well ; since we are providing configurations for metadata_options every deployment will create new versions for our launch templates which sadly trigger updates on our EKS node pools.

We met this issue as soon as we added metadata_options to our definitions.

@seanamos
Copy link

For those running into this, it seems to be as a result of a terraform bug when http_endpoint isn't explicitly set.

Setting http_endpoint = "enabled" makes things work as expected.

@ohookins
Copy link
Contributor

The documentation says that http_endpoint defaults to enabled, but this doesn't seem to be the reality of what is implemented.

dilchenko pushed a commit to gravitational/teleport-cluster-terraform that referenced this issue Oct 28, 2022
dilchenko pushed a commit to gravitational/teleport-cluster-terraform that referenced this issue Oct 28, 2022
dilchenko pushed a commit to gravitational/teleport-cluster-terraform that referenced this issue Oct 28, 2022
dilchenko pushed a commit to gravitational/teleport-cluster-terraform that referenced this issue Oct 28, 2022
* Fix bug hashicorp/terraform-provider-aws#25909 (comment)

* New proxy ACM validation approach

* No more license file

* terraform fmt
@good92
Copy link

good92 commented Feb 13, 2023

#29024

@good92
Copy link

good92 commented Feb 13, 2023

#24774

@good92
Copy link

good92 commented Feb 13, 2023

terraform-aws-modules/terraform-aws-eks#1785
"Yes, the problems seem to be related to the instance_metadata_tags = "enabled". Once disabled the problem disapears"

ok, we've changed the default behavior to disabled - disappointing that AWS has different tag requirements but we will leave it up to users to manage for now

@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!

@github-actions
Copy link

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 have found a problem that seems similar to this, 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 Apr 30, 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.
Projects
None yet
8 participants