terraform-aws-eks icon indicating copy to clipboard operation
terraform-aws-eks copied to clipboard

Create EC2 instances without "Name" tags

Open moleskin-smile opened this issue 2 years ago • 2 comments

Is your request related to a new offering from AWS?

Is this functionality available in the AWS provider for Terraform? See CHANGELOG.md, too.

  • Yes ✅. It's about functionality of this module (terraform-aws-eks).

Is your request related to a problem? Please describe.

Yes. I'm trying to convince EKS module to not create ASG/Launch Template configuration with Name tags propagated to instances.

Describe the solution you'd like.

A boolean variable propagate_name_tags_to_instances (or equivalent), defaulting to true that would allow to disable this functionality.

Additional context

My main issue is to get rid of additional name tags in Datadog metrics that emit their own (metric-specific) name tags (or just any metric). We use EC2 tags to Datadog tags propagation and we like it, but "name" is such a generic name, it doesn't mean anything (unless taken in context of a specific metric). Duplicated tags prevent us from creating Events-based monitoring. And the Name tags are useful only for browsing through AWS Console (UI) which is not often for people using Terraform (us). And nodes in question are not named in a unique way – they're named after their parent ASG. We can live without these tags easily if it fixes any of our issues.

Describe alternatives you've considered.

I've considered several alternatives.

Fix Datadog agent

The obvious solution is to make Datadog agents ignore that one EC2 instance tag, but there is no such option. (There is such option for GCE, though). I'm considering reporting this to Datadog as well.

Override tag with tag values "null"

There is an option to remove Launch Template tags. Due to merge used in eks code, we could simply:

  launch_template_tags = {
    Name  = null
  }

And then Terraform removes null tags from Launch Templates.

But it can't be done for ASG propagate_at_launch tags, so instances are still Name-tagged.

Override with autoscaling_group_tags

autoscaling_group_tags node group property allows to set up tags not propagated to instances. There is no merge, each tag is a tag { ... } schema. It looks like it Terraform doesn't sort these things internally or apply it in order – the results vary between different autoscaling groups. For some autoscaling groups the propagated tag wins, for others – the not propagated one. (It doesn't change for a single ASG when applied multiple times though).

moleskin-smile avatar Aug 04 '22 23:08 moleskin-smile

This issue has been automatically marked as stale because it has been open 30 days with no activity. Remove stale label or comment or this issue will be closed in 10 days

github-actions[bot] avatar Sep 04 '22 00:09 github-actions[bot]

I have an idea how to solve this in a really simple way – introduce a variable with the name of the instance name tag, defaulting to "Name". Then it would be completely transparent to people not interested in changing it, but would allow everybody else to change it. If there are no objections, I can try submitting this.

moleskin-smile avatar Sep 09 '22 08:09 moleskin-smile

see https://github.com/terraform-aws-modules/terraform-aws-eks/pull/2229#issuecomment-1246827499

bryantbiggs avatar Sep 26 '22 13:09 bryantbiggs

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[bot] avatar Nov 08 '22 02:11 github-actions[bot]