fix: More compatibility fixes for Terraform v0.13 and aws v3 (#976)

Additional support for Terraform v0.13 and aws v3!
- The update to the vpc module in examples was, strictly speaking, unnecessary but it adds the terraform block with supported versions.
- Update for iam module in the example was very necessary to support new versions
- Workaround for "Provider produced inconsistent final plan" when creating ASGs at the same time as the cluster. See  https://github.com/terraform-providers/terraform-provider-aws/issues/14085 for full details.
- Blacklist 0.13.0 as it was too strict when migrating from aws v2 to v3 about dropped attributes.
This commit is contained in:
Daniel Piddock
2020-09-08 18:25:46 +02:00
committed by GitHub
parent ad5373dc61
commit bceb966dfd
11 changed files with 71 additions and 56 deletions

View File

@@ -102,31 +102,38 @@ resource "aws_autoscaling_group" "workers" {
}
}
tags = concat(
[
{
"key" = "Name"
"value" = "${aws_eks_cluster.this[0].name}-${lookup(var.worker_groups[count.index], "name", count.index)}-eks_asg"
"propagate_at_launch" = true
},
{
"key" = "kubernetes.io/cluster/${aws_eks_cluster.this[0].name}"
"value" = "owned"
"propagate_at_launch" = true
},
{
"key" = "k8s.io/cluster/${aws_eks_cluster.this[0].name}"
"value" = "owned"
"propagate_at_launch" = true
},
],
local.asg_tags,
lookup(
var.worker_groups[count.index],
"tags",
local.workers_group_defaults["tags"]
dynamic "tag" {
for_each = concat(
[
{
"key" = "Name"
"value" = "${aws_eks_cluster.this[0].name}-${lookup(var.worker_groups[count.index], "name", count.index)}-eks_asg"
"propagate_at_launch" = true
},
{
"key" = "kubernetes.io/cluster/${aws_eks_cluster.this[0].name}"
"value" = "owned"
"propagate_at_launch" = true
},
{
"key" = "k8s.io/cluster/${aws_eks_cluster.this[0].name}"
"value" = "owned"
"propagate_at_launch" = true
},
],
local.asg_tags,
lookup(
var.worker_groups[count.index],
"tags",
local.workers_group_defaults["tags"]
)
)
)
content {
key = tag.value.key
value = tag.value.value
propagate_at_launch = tag.value.propagate_at_launch
}
}
lifecycle {
create_before_destroy = true