Skip to content

Commit 39be61d

Browse files
authored
fix: Correct access policy logic to support not providing a policy to associate (#3464)
1 parent b745952 commit 39be61d

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ We are grateful to the community for contributing bugfixes and improvements! Ple
381381

382382
| Name | Description | Type | Default | Required |
383383
|------|-------------|------|---------|:--------:|
384-
| <a name="input_access_entries"></a> [access\_entries](#input\_access\_entries) | Map of access entries to add to the cluster | <pre>map(object({<br/> # Access entry<br/> kubernetes_groups = optional(list(string))<br/> principal_arn = string<br/> type = optional(string, "STANDARD")<br/> user_name = optional(string)<br/> tags = optional(map(string), {})<br/> # Access policy association<br/> policy_associations = optional(map(object({<br/> policy_arn = string<br/> access_scope = object({<br/> namespaces = optional(list(string))<br/> type = string<br/> })<br/> })))<br/> }))</pre> | `{}` | no |
384+
| <a name="input_access_entries"></a> [access\_entries](#input\_access\_entries) | Map of access entries to add to the cluster | <pre>map(object({<br/> # Access entry<br/> kubernetes_groups = optional(list(string))<br/> principal_arn = string<br/> type = optional(string, "STANDARD")<br/> user_name = optional(string)<br/> tags = optional(map(string), {})<br/> # Access policy association<br/> policy_associations = optional(map(object({<br/> policy_arn = string<br/> access_scope = object({<br/> namespaces = optional(list(string))<br/> type = string<br/> })<br/> })), {})<br/> }))</pre> | `{}` | no |
385385
| <a name="input_additional_security_group_ids"></a> [additional\_security\_group\_ids](#input\_additional\_security\_group\_ids) | List of additional, externally created security group IDs to attach to the cluster control plane | `list(string)` | `[]` | no |
386386
| <a name="input_addons"></a> [addons](#input\_addons) | Map of cluster addon configurations to enable for the cluster. Addon name can be the map keys or set with `name` | <pre>map(object({<br/> name = optional(string) # will fall back to map key<br/> before_compute = optional(bool, false)<br/> most_recent = optional(bool, true)<br/> addon_version = optional(string)<br/> configuration_values = optional(string)<br/> pod_identity_association = optional(list(object({<br/> role_arn = string<br/> service_account = string<br/> })))<br/> preserve = optional(bool, true)<br/> resolve_conflicts_on_create = optional(string, "NONE")<br/> resolve_conflicts_on_update = optional(string, "OVERWRITE")<br/> service_account_role_arn = optional(string)<br/> timeouts = optional(object({<br/> create = optional(string)<br/> update = optional(string)<br/> delete = optional(string)<br/> }))<br/> tags = optional(map(string), {})<br/> }))</pre> | `null` | no |
387387
| <a name="input_addons_timeouts"></a> [addons\_timeouts](#input\_addons\_timeouts) | Create, update, and delete timeout configurations for the cluster addons | <pre>object({<br/> create = optional(string)<br/> update = optional(string)<br/> delete = optional(string)<br/> })</pre> | `null` | no |

main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ locals {
269269
# associations within a single entry
270270
flattened_access_entries = flatten([
271271
for entry_key, entry_val in local.merged_access_entries : [
272-
for pol_key, pol_val in try(entry_val.policy_associations, {}) :
272+
for pol_key, pol_val in entry_val.policy_associations :
273273
merge(
274274
{
275275
principal_arn = entry_val.principal_arn

tests/eks-managed-node-group/main.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,12 @@ module "eks" {
408408
}
409409
}
410410
}
411+
412+
no-policy = {
413+
kubernetes_groups = ["something"]
414+
principal_arn = data.aws_caller_identity.current.arn
415+
user_name = "someone"
416+
}
411417
}
412418

413419
tags = local.tags

variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ variable "access_entries" {
218218
namespaces = optional(list(string))
219219
type = string
220220
})
221-
})))
221+
})), {})
222222
}))
223223
default = {}
224224
}

0 commit comments

Comments
 (0)