Closed daroga0002 closed 3 years ago
@daroga0002 I assume that this issue is only impacting where var.create_eks == false
and not what was reported yesterday?
I saw this behaviour yesterday and assumed that it wasn't an issue as it was previously working, but one reviewing again today I can see the issue. Off the top of my head a fix would be to set cluster_name = var.create_eks ? coalescelist(aws_eks_cluster.this[*].name, [""])[0] : var.cluster_name
.
Furthermore should the module be able to create MNGs if var.create_eks == false
?
@daroga0002 I assume that this issue is only impacting where
var.create_eks == false
and not what was reported yesterday?
yes only case where we have var.create_eks == false
Furthermore should the module be able to create MNGs if
var.create_eks == false
?
Node groups are not created when we have var.create_eks == false
because of this trick:
https://github.com/terraform-aws-modules/terraform-aws-eks/blob/f198efd2c4ed695c8018ee343701454069806790/modules/node_groups/locals.tf#L43
@daroga0002 I'm aware of the trick to block their creation, but they could be created if that was changed and the input variables required could be passed in. The question was more if they "should" be able to be created?
RE a fix, do you have a preferred solution? The code I added above won't work as var.cluster_name
is optional, although I'm not sure why it needs to be?
RE a fix, do you have a preferred solution? The code I added above won't work as
var.cluster_name
is optional, although I'm not sure why it needs to be?
PR is created, var.cluster_name is just optional because to cover situation when you have create_eks=false
.
In general this is some legacy when modules where not supporting count in terraform so then was created this trigger. As of now probably the best should be just removing this but this will be huge breaking change.
Thanks for the fix.
RE empty var.cluster_name
and assuming that var.create_eks = false
is meant to mimic the official for_each = var.workspace_create_eks ? ["default"] : []
or count = var.workspace_create_eks ? 1 : 0
conditional module patterns, shouldn't the variables be required if they are needed by the module with the only change for create/not-create being var.create_eks
? This would still need your fix as it would support something like var.cluster_name = var.workspace_create_eks ? "my-cluster" : ""
but the idiomatic use would be var.cluster_name = "my-cluster"
.
in general var.create_eks
is as per me bad design as it was never working correctly because other dependencies like kubernetes provider configuration and etc.
I tried to use it in development and changing var.create_eks=true
to var.create_eks=false
was always dropping a bunch of problems. Ended by just holding EKS definition in eks.tf
file which I was renaming/removing in time when not required EKS
I'm going to lock this issue because it has been closed for 30 days β³. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Description
https://github.com/terraform-aws-modules/terraform-aws-eks/pull/1580 introduces bug which occurs when
var.create_eks
is setup for false. This is because https://github.com/terraform-aws-modules/terraform-aws-eks/blob/f198efd2c4ed695c8018ee343701454069806790/modules/node_groups/locals.tf#L1-L3 always require a input (which in case ofcreate_eks
is optional).In node group we are doing this by
if
https://github.com/terraform-aws-modules/terraform-aws-eks/blob/f198efd2c4ed695c8018ee343701454069806790/modules/node_groups/locals.tf#L43 so this is respected there.We need add to data source something like: https://github.com/terraform-aws-modules/terraform-aws-eks/blob/f198efd2c4ed695c8018ee343701454069806790/modules/fargate/main.tf#L13
β οΈ Note
Before you submit an issue, please perform the following first:
.terraform
directory (! ONLY if state is stored remotely, which hopefully you are following that best practice!):rm -rf .terraform/
terraform init
Versions
any versions of tf and aws provider
Reproduction
run
examples/complete
Expected behavior
It should not throw error
Actual behavior