fix: Disabling EKS auto-mode after it has been enabled #3515
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Changed the content in
eks_cluster
resource for dynamic blockskubernetes_network_config.elastic_load_balancing
andstorage_config
to be normal blocks instead of dynamic, so they are always resolved to eithertrue
orfalse
(default).Motivation and Context
The problem is whenever you enable EKS auto-mode, if you want to disable it in the future, it won't be possible to do it.
The reason behind this is that the dynamic blocks mentioned above are managed by local variable called
auto_mode_enabled
, which gets its value fromtry(var.compute_config.enabled, false)
, so it's either true or false.As seen in the blocks, if the local variable resolves to false, it won't create the dynamic blocks, which is great if you never enabled eks auto-mode, but if you ever enabled it, it will try to resolve the values to
null
instead offalse
, which terraform and AWS provider won't allow.You'll get error like this:
hashicorp/terraform-provider-aws#42483
#3273
These issues are not opened, but they haven't been resolved before.
Breaking Changes
It doesn't break anything, since the blocks for these values shouldn't be dynamic in the newer providers versions, they should always be set to either
true
orfalse
(all 3 blocks).#3273 (comment)
How Has This Been Tested?
examples/*
to demonstrate and validate my change(s)examples/*
projectsI have tested and validated these changes on a live project. (these changes were made for the project to get it working after the customer decided to disable EKS auto-mode after enabling it first)
pre-commit run -a
on my pull request