scholzj/terraform-aws-kubernetes

Error: Attribute redefined - The argument "tags" was already set

cmrust opened this issue · 5 comments

I'm receiving the following error on module version 1.6.1:

Error: Attribute redefined

  on .terraform/modules/kubernetes/scholzj-terraform-aws-kubernetes-6fb01f4/main.tf line 371, in resource "aws_autoscaling_group" "nodes":
 371:   tags = [{

The argument "tags" was already set at
.terraform/modules/kubernetes/scholzj-terraform-aws-kubernetes-6fb01f4/main.tf:365,3-7.
Each argument may be set only once.


Error: Attribute redefined

  on .terraform/modules/kubernetes/scholzj-terraform-aws-kubernetes-6fb01f4/main.tf line 377, in resource "aws_autoscaling_group" "nodes":
 377:   tags = ["${var.tags2}"]

The argument "tags" was already set at
.terraform/modules/kubernetes/scholzj-terraform-aws-kubernetes-6fb01f4/main.tf:365,3-7.
Each argument may be set only once.

It seems the tags attribute shouldn't be redeclared over and over here:

resource "aws_autoscaling_group" "nodes" {
vpc_zone_identifier = ["${var.worker_subnet_ids}"]
name = "${var.cluster_name}-nodes"
max_size = "${var.max_worker_count}"
min_size = "${var.min_worker_count}"
desired_capacity = "${var.min_worker_count}"
launch_configuration = "${aws_launch_configuration.nodes.name}"
tags = [{
key = "Name"
value = "${var.cluster_name}-node"
propagate_at_launch = true
}]
tags = [{
key = "kubernetes.io/cluster/${var.cluster_name}"
value = "owned"
propagate_at_launch = true
}]
tags = ["${var.tags2}"]
lifecycle {
ignore_changes = ["desired_capacity"]
}
}

This seems to work fine for me with Terraform 0.11.11. What version of Terraform are you using?

Hey @scholzj. Yep, looks like this error is specific to 0.12.0, which was just released. Rolled back to 0.11.14 and it's working fine again. To clarify above, this error was generated during a terraform init.

Hmm, I will have a look if there is some workaround.

FYI: I'm thinking about moving to Terraform 0.12.0 from Kubernetes 1.15. So that should be the timeframe I will look at this.

@cmrust I finally found some time to upgrade to Kubernetes 1.15.x and Terraform 0.12.x. Please give try to the last release.