Skip to content

Commit 79c0229

Browse files
authored
fix: Compact result of cluster security group to avoid disruptive updates when no security groups are supplied (#1934)
1 parent 7599e76 commit 79c0229

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ Users may encounter an error such as `Error: Invalid for_each argument - The "fo
2727
This error is due to an upstream issue with [Terraform core](https://github.com/hashicorp/terraform/issues/4149). There are two potential options you can take to help mitigate this issue:
2828

2929
1. Create the dependent resources before the cluster => `terraform apply -target <your policy or your security group>` and then `terraform apply` for the cluster (or other similar means to just ensure the referenced resources exist before creating the cluster)
30-
- Note: this is the route users will have to take for adding additonal security groups to nodes since there isn't a separate "security group attachment" resource
31-
2. For addtional IAM policies, users can attach the policies outside of the cluster definition as demonstrated below
30+
- Note: this is the route users will have to take for adding additional security groups to nodes since there isn't a separate "security group attachment" resource
31+
2. For additional IAM policies, users can attach the policies outside of the cluster definition as demonstrated below
3232

3333
```hcl
3434
resource "aws_iam_role_policy_attachment" "additional" {
3535
for_each = module.eks.eks_managed_node_groups
36-
# you could also do the following or any comibination:
36+
# you could also do the following or any combination:
3737
# for_each = merge(
3838
# module.eks.eks_managed_node_groups,
3939
# module.eks.self_managed_node_group,

main.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ resource "aws_eks_cluster" "this" {
1717
enabled_cluster_log_types = var.cluster_enabled_log_types
1818

1919
vpc_config {
20-
security_group_ids = distinct(concat(var.cluster_additional_security_group_ids, [local.cluster_security_group_id]))
20+
security_group_ids = compact(distinct(concat(var.cluster_additional_security_group_ids, [local.cluster_security_group_id])))
2121
subnet_ids = var.subnet_ids
2222
endpoint_private_access = var.cluster_endpoint_private_access
2323
endpoint_public_access = var.cluster_endpoint_public_access

0 commit comments

Comments
 (0)