我想要2个 worker 组,每个 worker 组都带有自定义标签。
例如,如果我使用此模板-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}
},

我在https://github.com/terraform-aws-modules/terraform-aws-eks/blob/v4.0.2/variables.tf中看到输入变量,第115-122行
和模板-https://github.com/terraform-aws-modules/terraform-aws-eks/blob/v4.0.2/workers.tf,第19-29行,
但我不明白如何正确配置它们以在工作程序上获取自定义标签。

最佳答案

我发现了它的实现位置以及example的使用方法:

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

关于kubernetes - Terraform EKS模块- worker 自定义标签,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/57261675/

10-15 19:15