Skip to content

Commit f7c604c

Browse files
add the additional_assume_role_principals param for cluster iam role
1 parent 7acf66f commit f7c604c

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,7 @@ We are grateful to the community for contributing bugfixes and improvements! Ple
428428
| <a name="input_create_cluster_security_group"></a> [create\_cluster\_security\_group](#input\_create\_cluster\_security\_group) | Determines if a security group is created for the cluster. Note: the EKS service creates a primary security group for the cluster by default | `bool` | `true` | no |
429429
| <a name="input_create_cni_ipv6_iam_policy"></a> [create\_cni\_ipv6\_iam\_policy](#input\_create\_cni\_ipv6\_iam\_policy) | Determines whether to create an [`AmazonEKS_CNI_IPv6_Policy`](https://docs.aws.amazon.com/eks/latest/userguide/cni-iam-role.html#cni-iam-role-create-ipv6-policy) | `bool` | `false` | no |
430430
| <a name="input_create_iam_role"></a> [create\_iam\_role](#input\_create\_iam\_role) | Determines whether an IAM role is created for the cluster | `bool` | `true` | no |
431+
| <a name="input_additional_assume_role_principals"></a> [additional\_assume\_role\_principals](#input\_additional\_assume\_principals) | List of additional principals to allow assuming the role | `list(object)` | `[]` | no |
431432
| <a name="input_create_kms_key"></a> [create\_kms\_key](#input\_create\_kms\_key) | Controls if a KMS key for cluster encryption should be created | `bool` | `true` | no |
432433
| <a name="input_create_node_iam_role"></a> [create\_node\_iam\_role](#input\_create\_node\_iam\_role) | Determines whether an EKS Auto node IAM role is created | `bool` | `true` | no |
433434
| <a name="input_create_node_security_group"></a> [create\_node\_security\_group](#input\_create\_node\_security\_group) | Determines whether to create a security group for the node groups or use the existing `node_security_group_id` | `bool` | `true` | no |

main.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,16 @@ data "aws_iam_policy_document" "assume_role_policy" {
489489
}
490490
}
491491
}
492+
dynamic "statement" {
493+
for_each = var.additional_assume_role_principals
494+
content {
495+
actions = statement.value.actions
496+
principals {
497+
type = statement.value.type
498+
identifiers = statement.value.identifiers
499+
}
500+
}
501+
}
492502
}
493503

494504
resource "aws_iam_role" "this" {

variables.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,16 @@ variable "enable_auto_mode_custom_tags" {
548548
default = true
549549
}
550550

551+
variable "additional_assume_role_principals" {
552+
description = "List of additional principals to allow assuming the role"
553+
type = list(object({
554+
type = string
555+
identifiers = list(string)
556+
actions = optional(list(string), ["sts:AssumeRole"])
557+
}))
558+
default = []
559+
}
560+
551561
################################################################################
552562
# EKS Addons
553563
################################################################################

0 commit comments

Comments
 (0)