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

Additional_tags don't apply #318

Open
rupertgti opened this issue Oct 21, 2021 · 6 comments
Open

Additional_tags don't apply #318

rupertgti opened this issue Oct 21, 2021 · 6 comments
Labels
good first issue good for newcomers

Comments

@rupertgti
Copy link
Contributor

rupertgti commented Oct 21, 2021

Summary

I want to put some additional tags in my ec2 custom node groups.
I think the terraform plan show the correct changes but in the "reality" in AWS the module don't apply the custom tags and the result is the default tags of module

Terraform plan:

module.eks-jx.module.cluster.module.eks.module.node_groups.aws_eks_node_group.workers["custom-nodes"] will be created
  + resource "aws_eks_node_group" "workers" {
      + ami_type               = "AL2_x86_64"
      + arn                    = (known after apply)
      + capacity_type          = (known after apply)
      + cluster_name           = "my-cluster-name"
      + disk_size              = 150
      + id                     = (known after apply)
      + instance_types         = [
          + "m5.2xlarge",
        ]
      + labels                 = {
          + "instancegroup"           = "custom-nodes"
          + "jenkins-x.io/managed-by" = "terraform"
          + "jenkins-x.io/name"       = "my-cluster-name"
          + "jenkins-x.io/part-of"    = "jx-platform"
        }
      + node_group_name        = (known after apply)
      + node_group_name_prefix = "my-cluster-name-custom-nodes"
      + node_role_arn          = "arn:aws:iam::account:role/my-cluster-name20211021102140086300000015"
      + release_version        = (known after apply)
      + resources              = (known after apply)
      + status                 = (known after apply)
      + subnet_ids             = [
          + "subnet-xxxxx",
          + "subnet-xxxxx",
          + "subnet-xxxxx",
        ]
      + tags                   = {
          + "Name"        = "my-cluster-name-custom-nodes"
          + "environment" = "tag1"
          + "project"     = "tag2"
          + "resource"    = "tag3"
          + "service"     = "tag4"
        }
      + tags_all               = {
          + "Name"        = "my-cluster-name-custom-nodes"
          + "environment" = "tag1"
          + "project"     = "tag2"
          + "resource"    = "tag3"
          + "service"     = "tag4"

I add this in main.tf of module "eks-jx" {:

  node_groups_managed = {
    custom-nodes = {
      ami_type                = "AL2_x86_64"
      disk_size               = 150
      desired_capacity        = 1
      max_capacity            = 50
      min_capacity            = 1
      instance_types          = [ "r5.2xlarge" ]
      k8s_labels = {
        instancegroup = "custom-nodes"
      }
      additional_tags = {
        service = "tag1"
        Name = "my-cluster-name-custom-nodes"
        project = "tag2"
        environment	= "tag3"
        resource = "tag4"
      }
    }

the results in AWS Auto Scaling groups tags:

image

And my ec2 instances don't have the tags :(

Steps to reproduce the behavior

terraform plan and terraform apply

Terraform version

The output of terraform version is:

Terraform v0.13.7

Module version

1.16.1

Operating system

WSL2

@ankitm123
Copy link
Member

ankitm123 commented Oct 25, 2021

I will take a deeper look at this tonight, but most likely this is happening because u dont have propagate at launch set to true. Try PropagateAtLaunch=true and see if that fixes it.
See: https://docs.aws.amazon.com/autoscaling/ec2/userguide/autoscaling-tagging.html#add-tags

Well, I see u have tag new instances set to true, so what I said before is not correct, will look.

@ankitm123
Copy link
Member

Looking at this a bit more, it's related to this: terraform-aws-modules/terraform-aws-eks#860
which seems to be an AWS issue.

@rupertgti
Copy link
Contributor Author

rupertgti commented Oct 26, 2021

Thank you @ankitm123 for link to the main issue. But if it's an old problem, is it not possible to apply the workaround in the process: terraform-aws-modules/terraform-aws-eks#860 (comment)?

@ankitm123
Copy link
Member

But if it's an old problem, is it not possible to apply the workaround in the process: terraform-aws-modules/terraform-aws-eks#860 (comment)?

If you want to open a PR and fix it, I would be happy to review it :)

@rupertgti
Copy link
Contributor Author

I 'll try it

@ankitm123
Copy link
Member

We are participating in hacktoberfest also 😬

@ankitm123 ankitm123 added the good first issue good for newcomers label Jan 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants