Terraform-aws-eks: Subsequent apply runs cause subnet and vpc tags to get resetted

Created on 10 Apr 2019  路  4Comments  路  Source: terraform-aws-modules/terraform-aws-eks

I'm submitting a...

  • [x] bug report

What is the current behavior?

When running terraform apply after initial cluster setup, it resets the subnet annotations. There is a plan run illustrating this:

  ~ module.eks.module.vpc.aws_subnet.private[0]
      tags.%:                                  "2" => "1"
      tags.kubernetes.io/cluster/xx-default: "shared" => ""

  ~ module.eks.module.vpc.aws_subnet.private[1]
      tags.%:                                  "2" => "1"
      tags.kubernetes.io/cluster/xx-default: "shared" => ""

  ~ module.eks.module.vpc.aws_subnet.private[2]
      tags.%:                                  "2" => "1"
      tags.kubernetes.io/cluster/xx-default: "shared" => ""

  ~ module.eks.module.vpc.aws_vpc.this
      tags.%:                                  "2" => "1"
      tags.kubernetes.io/cluster/xx-default: "shared" => ""

If this is a bug, how to reproduce? Please include a code sample if relevant.

Deploy cluster, run plan again.

What's the expected behavior?

It should either set those itself or ignore the attribute.

Environment details

  • Affected module version: 2.3.1
  • OS: linux
  • Terraform version: v0.11.11

Most helpful comment

I think you need to add the tag tags.kubernetes.io/cluster/xx-default to your module at module.eks.module.vpc?

All 4 comments

I think you need to add the tag tags.kubernetes.io/cluster/xx-default to your module at module.eks.module.vpc?

Ah yeah, that should solve it. Thanks again!

Thanks for this answer. But I'm not very clear as how to implement this. I've my infra structure as below

  • main.tf
  • vpc.tf (Uses terraform-aws-vpc module to create vpc and other networking stack)
  • eks.tf (Creates eks cluster).

Re running terraform apply removes tag kubernetes.io/cluster/${var.name} = "shared". I don't follow what you mean by

I think you need to add the tag tags.kubernetes.io/cluster/xx-default to your module at module.eks.module.vpc?

Can you please share one example.

Can you please share one example.

There are examples in this repo, for example here: https://github.com/terraform-aws-modules/terraform-aws-eks/tree/master/examples/basic

Was this page helpful?
0 / 5 - 0 ratings