terraform-aws-eks
terraform-aws-eks copied to clipboard
Unexpected behavior when utilizing `create_eks = false` for worker_groups module
Describe the bug
Im utilizing the worker_groups module independently of the control_plane
module and when doing some testing of the module when setting create_eks
to false I am receiving the following error.
Error: name must not be empty, got
on .terraform/modules/<REDACTED>.worker-nodes/modules/worker_groups/data.tf line 10, in data "aws_eks_cluster" "this":
10: data "aws_eks_cluster" "this" {
In my current setup the resources already exist for the cluster and this is part of a teardown test but I suspect this would occur without resources in place as the data lookup will attempt to happen regardless of the state of the create_eks
flag.
To Reproduce Steps to reproduce the behavior:
- Create a instance of the worker_group module(v10.2.3) with
create_eks
set totrue
- Standup supporting infrastructure and validate its setup correctly.
- Update configuration such that
create_eks
is set tofalse
- Generate a plan to observe the error above.
Expected behavior
I would expect the module to be able to properly handle the setting of create_eks
to false without generating an error.
Additional context While not a direct solution this scenario is mentioned explicitly in the original upstream documentation here: https://github.com/terraform-aws-modules/terraform-aws-eks#conditional-creation and I assume because the data block in question resides inside the module a similar construct would need to be put in place.
It also looks like the aws_auth
module is suffering from the same.