From 54a5f1e42b7e2b17f298e4ff19a4821e3de97201 Mon Sep 17 00:00:00 2001 From: Dawid Rogaczewski <20227477+daroga0002@users.noreply.github.com> Date: Tue, 12 Oct 2021 12:45:41 +0200 Subject: [PATCH] fix: bug with data source in managed groups submodule (#1633) --- modules/node_groups/launch_template.tf | 4 ++-- modules/node_groups/locals.tf | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/node_groups/launch_template.tf b/modules/node_groups/launch_template.tf index 0bbb0f8d4e..5c2243d4c5 100644 --- a/modules/node_groups/launch_template.tf +++ b/modules/node_groups/launch_template.tf @@ -14,8 +14,8 @@ data "cloudinit_config" "workers_userdata" { ami_id = lookup(each.value, "ami_id", "") ami_is_eks_optimized = each.value["ami_is_eks_optimized"] cluster_name = var.cluster_name - cluster_endpoint = data.aws_eks_cluster.default.endpoint - cluster_ca = data.aws_eks_cluster.default.certificate_authority[0].data + cluster_endpoint = data.aws_eks_cluster.default[0].endpoint + cluster_ca = data.aws_eks_cluster.default[0].certificate_authority[0].data capacity_type = lookup(each.value, "capacity_type", "ON_DEMAND") append_labels = length(lookup(each.value, "k8s_labels", {})) > 0 ? ",${join(",", [for k, v in lookup(each.value, "k8s_labels", {}) : "${k}=${v}"])}" : "" } diff --git a/modules/node_groups/locals.tf b/modules/node_groups/locals.tf index 8454e0b607..490a42d306 100644 --- a/modules/node_groups/locals.tf +++ b/modules/node_groups/locals.tf @@ -1,4 +1,6 @@ data "aws_eks_cluster" "default" { + count = var.create_eks ? 1 : 0 + name = var.cluster_name }