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" => ""
Deploy cluster, run plan again.
It should either set those itself or ignore the attribute.
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
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
Most helpful comment
I think you need to add the tag
tags.kubernetes.io/cluster/xx-defaultto your module atmodule.eks.module.vpc?