diff --git a/CHANGELOG.md b/CHANGELOG.md index ee4970c..332fa94 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ project adheres to [Semantic Versioning](http://semver.org/). ### Changed + - Fixed errors sometimes happening during destroy due to usage of coalesce() in local.tf (by @petrikero) - Write your awesome change here (by @you) # History diff --git a/local.tf b/local.tf index 915c8b2..07c3504 100644 --- a/local.tf +++ b/local.tf @@ -1,28 +1,11 @@ locals { asg_tags = null_resource.tags_as_list_of_maps.*.triggers - # Followed recommendation http://67bricks.com/blog/?p=85 - # to workaround terraform not supporting short circut evaluation - cluster_security_group_id = coalesce( - join("", aws_security_group.cluster.*.id), - var.cluster_security_group_id, - ) + cluster_security_group_id = var.cluster_create_security_group ? aws_security_group.cluster[0].id : var.cluster_security_group_id + cluster_iam_role_name = var.manage_cluster_iam_resources ? aws_iam_role.cluster[0].name : var.cluster_iam_role_name + cluster_iam_role_arn = var.manage_cluster_iam_resources ? aws_iam_role.cluster[0].arn : data.aws_iam_role.custom_cluster_iam_role[0].arn + worker_security_group_id = var.worker_create_security_group ? aws_security_group.workers[0].id : var.worker_security_group_id - cluster_iam_role_name = coalesce( - join("", aws_iam_role.cluster.*.name), - var.cluster_iam_role_name, - "aws-eks" - ) - cluster_iam_role_arn = coalesce( - join("", aws_iam_role.cluster.*.arn), - join("", data.aws_iam_role.custom_cluster_iam_role.*.arn), - "aws-eks" - ) - - worker_security_group_id = coalesce( - join("", aws_security_group.workers.*.id), - var.worker_security_group_id, - ) default_iam_role_id = concat(aws_iam_role.workers.*.id, [""])[0] kubeconfig_name = var.kubeconfig_name == "" ? "eks_${var.cluster_name}" : var.kubeconfig_name