Skip to content

Commit 93ffdfc

Browse files
authored
fix: Revert #3058 - fix: Invoke aws_iam_session_context data source only when required (#3092)
fix: Revert #3058
1 parent 27d649a commit 93ffdfc

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

main.tf

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ data "aws_partition" "current" {}
22
data "aws_caller_identity" "current" {}
33

44
data "aws_iam_session_context" "current" {
5-
count = (var.create && var.enable_cluster_creator_admin_permissions) || (var.create && var.create_kms_key && local.enable_cluster_encryption_config) ? 1 : 0
65
# This data source provides information on the IAM source role of an STS assumed role
76
# For non-role ARNs, this data source simply passes the ARN through issuer ARN
87
# Ref https://github.com/terraform-aws-modules/terraform-aws-eks/issues/2327#issuecomment-1355581682
@@ -148,7 +147,7 @@ locals {
148147
# better controlled by users through Terraform
149148
bootstrap_cluster_creator_admin_permissions = {
150149
cluster_creator = {
151-
principal_arn = data.aws_iam_session_context.current[0].issuer_arn
150+
principal_arn = data.aws_iam_session_context.current.issuer_arn
152151
type = "STANDARD"
153152

154153
policy_associations = {
@@ -237,7 +236,7 @@ module "kms" {
237236
# Policy
238237
enable_default_policy = var.kms_key_enable_default_policy
239238
key_owners = var.kms_key_owners
240-
key_administrators = coalescelist(var.kms_key_administrators, [data.aws_iam_session_context.current[0].issuer_arn])
239+
key_administrators = coalescelist(var.kms_key_administrators, [data.aws_iam_session_context.current.issuer_arn])
241240
key_users = concat([local.cluster_role], var.kms_key_users)
242241
key_service_users = var.kms_key_service_users
243242
source_policy_documents = var.kms_key_source_policy_documents

0 commit comments

Comments
 (0)