diff --git a/examples/create_false/main.tf b/examples/create_false/main.tf index 0aa61ef959..b58f0f5a21 100644 --- a/examples/create_false/main.tf +++ b/examples/create_false/main.tf @@ -13,9 +13,9 @@ data "aws_eks_cluster_auth" "cluster" { } provider "kubernetes" { - host = element(concat(data.aws_eks_cluster.cluster[*].endpoint, list("")), 0) - cluster_ca_certificate = base64decode(element(concat(data.aws_eks_cluster.cluster[*].certificate_authority.0.data, list("")), 0)) - token = element(concat(data.aws_eks_cluster_auth.cluster[*].token, list("")), 0) + host = element(concat(data.aws_eks_cluster.cluster[*].endpoint, [""]), 0) + cluster_ca_certificate = base64decode(element(concat(data.aws_eks_cluster.cluster[*].certificate_authority.0.data, [""]), 0)) + token = element(concat(data.aws_eks_cluster_auth.cluster[*].token, [""]), 0) load_config_file = false version = "~> 1.11" } diff --git a/local.tf b/local.tf index 09d62f0df2..517fe7ab97 100644 --- a/local.tf +++ b/local.tf @@ -1,7 +1,7 @@ locals { cluster_security_group_id = var.cluster_create_security_group ? join("", aws_security_group.cluster.*.id) : var.cluster_security_group_id - cluster_primary_security_group_id = var.cluster_version >= 1.14 ? element(concat(aws_eks_cluster.this[*].vpc_config[0].cluster_security_group_id, list("")), 0) : null + cluster_primary_security_group_id = var.cluster_version >= 1.14 ? element(concat(aws_eks_cluster.this[*].vpc_config[0].cluster_security_group_id, [""]), 0) : null cluster_iam_role_name = var.manage_cluster_iam_resources ? join("", aws_iam_role.cluster.*.name) : var.cluster_iam_role_name cluster_iam_role_arn = var.manage_cluster_iam_resources ? join("", aws_iam_role.cluster.*.arn) : join("", data.aws_iam_role.custom_cluster_iam_role.*.arn) worker_security_group_id = var.worker_create_security_group ? join("", aws_security_group.workers.*.id) : var.worker_security_group_id diff --git a/modules/fargate/locals.tf b/modules/fargate/locals.tf index 4216953b77..18ba96403b 100644 --- a/modules/fargate/locals.tf +++ b/modules/fargate/locals.tf @@ -1,7 +1,7 @@ locals { create_eks = var.create_eks && length(var.fargate_profiles) > 0 - pod_execution_role_arn = var.create_fargate_pod_execution_role ? element(concat(aws_iam_role.eks_fargate_pod.*.arn, list("")), 0) : element(concat(data.aws_iam_role.custom_fargate_iam_role.*.arn, list("")), 0) - pod_execution_role_name = var.create_fargate_pod_execution_role ? element(concat(aws_iam_role.eks_fargate_pod.*.name, list("")), 0) : element(concat(data.aws_iam_role.custom_fargate_iam_role.*.name, list("")), 0) + pod_execution_role_arn = var.create_fargate_pod_execution_role ? element(concat(aws_iam_role.eks_fargate_pod.*.arn, [""]), 0) : element(concat(data.aws_iam_role.custom_fargate_iam_role.*.arn, [""]), 0) + pod_execution_role_name = var.create_fargate_pod_execution_role ? element(concat(aws_iam_role.eks_fargate_pod.*.name, [""]), 0) : element(concat(data.aws_iam_role.custom_fargate_iam_role.*.name, [""]), 0) fargate_profiles_expanded = { for k, v in var.fargate_profiles : k => merge( v, diff --git a/outputs.tf b/outputs.tf index 3cf145236d..62d75aaf0f 100644 --- a/outputs.tf +++ b/outputs.tf @@ -1,6 +1,6 @@ output "cluster_id" { description = "The name/id of the EKS cluster. Will block on cluster creation until the cluster is really ready" - value = element(concat(aws_eks_cluster.this.*.id, list("")), 0) + value = element(concat(aws_eks_cluster.this.*.id, [""]), 0) # So that calling plans wait for the cluster to be available before attempting # to use it. They will not need to duplicate this null_resource depends_on = [null_resource.wait_for_cluster] @@ -8,22 +8,22 @@ output "cluster_id" { output "cluster_arn" { description = "The Amazon Resource Name (ARN) of the cluster." - value = element(concat(aws_eks_cluster.this.*.arn, list("")), 0) + value = element(concat(aws_eks_cluster.this.*.arn, [""]), 0) } output "cluster_certificate_authority_data" { description = "Nested attribute containing certificate-authority-data for your cluster. This is the base64 encoded certificate data required to communicate with your cluster." - value = element(concat(aws_eks_cluster.this[*].certificate_authority[0].data, list("")), 0) + value = element(concat(aws_eks_cluster.this[*].certificate_authority[0].data, [""]), 0) } output "cluster_endpoint" { description = "The endpoint for your EKS Kubernetes API." - value = element(concat(aws_eks_cluster.this.*.endpoint, list("")), 0) + value = element(concat(aws_eks_cluster.this.*.endpoint, [""]), 0) } output "cluster_version" { description = "The Kubernetes server version for the EKS cluster." - value = element(concat(aws_eks_cluster.this[*].version, list("")), 0) + value = element(concat(aws_eks_cluster.this[*].version, [""]), 0) } output "cluster_security_group_id" { @@ -58,12 +58,12 @@ output "cluster_primary_security_group_id" { output "cloudwatch_log_group_name" { description = "Name of cloudwatch log group created" - value = element(concat(aws_cloudwatch_log_group.this[*].name, list("")), 0) + value = element(concat(aws_cloudwatch_log_group.this[*].name, [""]), 0) } output "cloudwatch_log_group_arn" { description = "Arn of cloudwatch log group created" - value = element(concat(aws_cloudwatch_log_group.this[*].arn, list("")), 0) + value = element(concat(aws_cloudwatch_log_group.this[*].arn, [""]), 0) } output "kubeconfig" { diff --git a/workers.tf b/workers.tf index 8143e6a304..3ff699c2bc 100644 --- a/workers.tf +++ b/workers.tf @@ -133,11 +133,11 @@ resource "aws_autoscaling_group" "workers" { ], [ for tag_key, tag_value in var.tags : - map( - "key", tag_key, - "value", tag_value, - "propagate_at_launch", "true" - ) + { + "key" : tag_key, + "value" : tag_value, + "propagate_at_launch" : "true" + } if tag_key != "Name" && !contains([for tag in lookup(var.worker_groups[count.index], "tags", local.workers_group_defaults["tags"]) : tag["key"]], tag_key) ], lookup( diff --git a/workers_launch_template.tf b/workers_launch_template.tf index f574fcc510..d89d071b16 100644 --- a/workers_launch_template.tf +++ b/workers_launch_template.tf @@ -100,7 +100,7 @@ resource "aws_autoscaling_group" "workers_launch_template" { dynamic "mixed_instances_policy" { iterator = item - for_each = (lookup(var.worker_groups_launch_template[count.index], "override_instance_types", null) != null) || (lookup(var.worker_groups_launch_template[count.index], "on_demand_allocation_strategy", local.workers_group_defaults["on_demand_allocation_strategy"]) != null) ? list(var.worker_groups_launch_template[count.index]) : [] + for_each = (lookup(var.worker_groups_launch_template[count.index], "override_instance_types", null) != null) || (lookup(var.worker_groups_launch_template[count.index], "on_demand_allocation_strategy", local.workers_group_defaults["on_demand_allocation_strategy"]) != null) ? [var.worker_groups_launch_template[count.index]] : [] content { instances_distribution { @@ -164,7 +164,7 @@ resource "aws_autoscaling_group" "workers_launch_template" { dynamic "launch_template" { iterator = item - for_each = (lookup(var.worker_groups_launch_template[count.index], "override_instance_types", null) != null) || (lookup(var.worker_groups_launch_template[count.index], "on_demand_allocation_strategy", local.workers_group_defaults["on_demand_allocation_strategy"]) != null) ? [] : list(var.worker_groups_launch_template[count.index]) + for_each = (lookup(var.worker_groups_launch_template[count.index], "override_instance_types", null) != null) || (lookup(var.worker_groups_launch_template[count.index], "on_demand_allocation_strategy", local.workers_group_defaults["on_demand_allocation_strategy"]) != null) ? [] : [var.worker_groups_launch_template[count.index]] content { id = aws_launch_template.workers_launch_template.*.id[count.index] @@ -209,11 +209,11 @@ resource "aws_autoscaling_group" "workers_launch_template" { ], [ for tag_key, tag_value in var.tags : - map( - "key", tag_key, - "value", tag_value, - "propagate_at_launch", "true" - ) + { + "key" : tag_key, + "value" : tag_value, + "propagate_at_launch" : "true" + } if tag_key != "Name" && !contains([for tag in lookup(var.worker_groups_launch_template[count.index], "tags", local.workers_group_defaults["tags"]) : tag["key"]], tag_key) ], lookup( @@ -363,7 +363,7 @@ resource "aws_launch_template" "workers_launch_template" { } dynamic "instance_market_options" { - for_each = lookup(var.worker_groups_launch_template[count.index], "market_type", null) == null ? [] : list(lookup(var.worker_groups_launch_template[count.index], "market_type", null)) + for_each = lookup(var.worker_groups_launch_template[count.index], "market_type", null) == null ? [] : [lookup(var.worker_groups_launch_template[count.index], "market_type", null)] content { market_type = instance_market_options.value }