Skip to content

Commit

Permalink
fix: bug with data source in managed groups submodule (#1633)
Browse files Browse the repository at this point in the history
  • Loading branch information
daroga0002 authored Oct 12, 2021
1 parent f198efd commit 54a5f1e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions modules/node_groups/launch_template.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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}"])}" : ""
}
Expand Down
2 changes: 2 additions & 0 deletions modules/node_groups/locals.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
data "aws_eks_cluster" "default" {
count = var.create_eks ? 1 : 0

name = var.cluster_name
}

Expand Down

4 comments on commit 54a5f1e

@rastakajakwanna
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change makes creating new cluster impossible because when var.create_eks=true (default), then count=1 and then data tries to get info about "EXISTING" cluster and it fails with the error below because it does not exist yet.

Error: error reading EKS Cluster (test-cluster): couldn't find resource

Am I overlooking something or this commit is simply wrong?

@marcelobartsch-jt
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same problem for me

@bragibbo
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same issue

@daroga0002
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are aware of this issue and working on solution, but in general you can pin exact version of module into your code (what is best practice in terraform)

Please sign in to comment.