3
votes

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.

2
Documentation shows how to do this: github.com/terraform-aws-modules/…Matt Schuchard
yes, it shows, but it doesn't work(at least with the provided template example)malyy
Ok, but your provided code in the question conflicts with the documentation, so does the question differ from your implementation?Matt Schuchard

2 Answers

1
votes

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
     },
   ],
 }
1
votes

The current version has changed slightly:

worker_groups = [
{
  name = "worker-group-1"
  ....
  
  tags = [
    {
      key                 = "k1"
      value               = "v1"
      propagate_at_launch = true
    },
    {
      key                 = "k2"
      value               = "v2"
      propagate_at_launch = true
    }
   ] 
}]