Terraform eks module - workers custom tags

7/29/2019

I want to have 2 worker groups, each with custom tag. For example, if I use this template - https://github.com/terraform-aws-modules/terraform-aws-eks/blob/v4.0.2/examples/basic/main.tf

 worker_groups = [
{
  name                          = "worker-group-1"
 ....
  //here - what I want to have
  tags = {selector=wg1}
},
{
  name                          = "worker-group-2"
  ....
  //here - what I want to have
  tags = {selector=wg2}
},

I see the input variables in https://github.com/terraform-aws-modules/terraform-aws-eks/blob/v4.0.2/variables.tf , lines 115-122 and template - https://github.com/terraform-aws-modules/terraform-aws-eks/blob/v4.0.2/workers.tf , lines 19-29, but I can't understand how to properly configure them to get custom tags on workers.

-- malyy
amazon-eks
aws-eks
eks
kubernetes
terraform

1 Answer

8/1/2019

I've found where it was implemented and the example how to use it:

worker_groups = [
{
  name                          = "worker-group-1"
 ....
},
{
  name                          = "worker-group-2"
  ....
},
]

// and here comes the tags block
worker_group_tags = {
  worker-group-1 = [
    {
      key   = "k1"
      value = "v1"
      key                 = "k2"
      value               = "v2"
      propagate_at_launch = true
     },
   ],
   worker-group-2 = [
     {
       key   = "k3"
       value = "v3"
       key                 = "k4"
       value               = "v4"
       propagate_at_launch = true
     },
   ],
 }
-- malyy
Source: StackOverflow