Skip to content

Commit 035852d

Browse files
committed
fix: Revert forcing a value for all EKS Auto Mode fields now that provider handles this
1 parent 2ad67a5 commit 035852d

File tree

5 files changed

+24
-8
lines changed

5 files changed

+24
-8
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/antonbabenko/pre-commit-terraform
3-
rev: v1.100.0
3+
rev: v1.101.0
44
hooks:
55
- id: terraform_fmt
66
- id: terraform_docs

README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,17 @@ Please note that we strive to provide a comprehensive suite of documentation for
2828

2929
### EKS Auto Mode
3030

31+
> ![WARNING]
32+
> Due to the current EKS Auto Mode API, to disable EKS Auto Mode you will have to explicity set:
33+
>
34+
>```hcl
35+
>compute_config = {
36+
> enabled = false
37+
> }
38+
>```
39+
>
40+
> If you try to disable by simply removing the `compute_config` block, this will fail to disble EKS Auto Mode. Only after applying with `enabled = false` can you then remove the `compute_config` block from your configurations.
41+
3142
```hcl
3243
module "eks" {
3344
source = "terraform-aws-modules/eks/aws"
@@ -75,6 +86,9 @@ module "eks" {
7586
7687
# Create just the IAM resources for EKS Auto Mode for use with custom node pools
7788
create_auto_mode_iam_resources = true
89+
compute_config = {
90+
enabled = true
91+
}
7892
7993
vpc_id = "vpc-1234556abcdef"
8094
subnet_ids = ["subnet-abcde012", "subnet-bcde012a", "subnet-fghi345a"]
@@ -422,7 +436,7 @@ We are grateful to the community for contributing bugfixes and improvements! Ple
422436
| <a name="input_cloudwatch_log_group_retention_in_days"></a> [cloudwatch\_log\_group\_retention\_in\_days](#input\_cloudwatch\_log\_group\_retention\_in\_days) | Number of days to retain log events. Default retention - 90 days | `number` | `90` | no |
423437
| <a name="input_cloudwatch_log_group_tags"></a> [cloudwatch\_log\_group\_tags](#input\_cloudwatch\_log\_group\_tags) | A map of additional tags to add to the cloudwatch log group created | `map(string)` | `{}` | no |
424438
| <a name="input_cluster_tags"></a> [cluster\_tags](#input\_cluster\_tags) | A map of additional tags to add to the cluster | `map(string)` | `{}` | no |
425-
| <a name="input_compute_config"></a> [compute\_config](#input\_compute\_config) | Configuration block for the cluster compute configuration | <pre>object({<br/> enabled = optional(bool, false)<br/> node_pools = optional(list(string))<br/> node_role_arn = optional(string)<br/> })</pre> | `{}` | no |
439+
| <a name="input_compute_config"></a> [compute\_config](#input\_compute\_config) | Configuration block for the cluster compute configuration | <pre>object({<br/> enabled = optional(bool, false)<br/> node_pools = optional(list(string))<br/> node_role_arn = optional(string)<br/> })</pre> | `null` | no |
426440
| <a name="input_control_plane_subnet_ids"></a> [control\_plane\_subnet\_ids](#input\_control\_plane\_subnet\_ids) | A list of subnet IDs where the EKS cluster control plane (ENIs) will be provisioned. Used for expanding the pool of subnets used by nodes/node groups without replacing the EKS control plane | `list(string)` | `[]` | no |
427441
| <a name="input_create"></a> [create](#input\_create) | Controls if resources should be created (affects nearly all resources) | `bool` | `true` | no |
428442
| <a name="input_create_auto_mode_iam_resources"></a> [create\_auto\_mode\_iam\_resources](#input\_create\_auto\_mode\_iam\_resources) | Determines whether to create/attach IAM resources for EKS Auto Mode. Useful for when using only custom node pools and not built-in EKS Auto Mode node pools | `bool` | `false` | no |

examples/eks-auto-mode/main.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ module "eks_auto_custom_node_pools" {
6060

6161
# Create just the IAM resources for EKS Auto Mode for use with custom node pools
6262
create_auto_mode_iam_resources = true
63+
compute_config = {
64+
enabled = true
65+
}
6366

6467
vpc_id = module.vpc.vpc_id
6568
subnet_ids = module.vpc.private_subnets

main.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ locals {
2626
create_outposts_local_cluster = var.outpost_config != null
2727
enable_encryption_config = var.encryption_config != null && !local.create_outposts_local_cluster
2828

29-
create_auto_mode_iam_resources = var.compute_config.enabled || var.create_auto_mode_iam_resources
29+
create_auto_mode_iam_resources = try(var.compute_config.enabled, false) == true || var.create_auto_mode_iam_resources
3030
}
3131

3232
################################################################################
@@ -58,7 +58,7 @@ resource "aws_eks_cluster" "this" {
5858
}
5959

6060
dynamic "compute_config" {
61-
for_each = [var.compute_config]
61+
for_each = var.compute_config != null ? [var.compute_config] : []
6262

6363
content {
6464
enabled = compute_config.value.enabled
@@ -81,7 +81,7 @@ resource "aws_eks_cluster" "this" {
8181

8282
content {
8383
dynamic "elastic_load_balancing" {
84-
for_each = [var.compute_config]
84+
for_each = var.compute_config != null ? [var.compute_config] : []
8585

8686
content {
8787
enabled = elastic_load_balancing.value.enabled
@@ -148,7 +148,7 @@ resource "aws_eks_cluster" "this" {
148148
}
149149

150150
dynamic "storage_config" {
151-
for_each = [var.compute_config]
151+
for_each = var.compute_config != null ? [var.compute_config] : []
152152

153153
content {
154154
block_storage {

variables.tf

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,7 @@ variable "compute_config" {
6969
node_pools = optional(list(string))
7070
node_role_arn = optional(string)
7171
})
72-
default = {}
73-
nullable = false
72+
default = null
7473
}
7574

7675
variable "upgrade_policy" {

0 commit comments

Comments
 (0)