Skip to content

Commit

Permalink
fix: Revert #3058 - fix: Invoke aws_iam_session_context data source o…
Browse files Browse the repository at this point in the history
…nly when required (#3092)

fix: Revert #3058
  • Loading branch information
bryantbiggs authored Jul 5, 2024
1 parent 27d649a commit 93ffdfc
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ data "aws_partition" "current" {}
data "aws_caller_identity" "current" {}

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

policy_associations = {
Expand Down Expand Up @@ -237,7 +236,7 @@ module "kms" {
# Policy
enable_default_policy = var.kms_key_enable_default_policy
key_owners = var.kms_key_owners
key_administrators = coalescelist(var.kms_key_administrators, [data.aws_iam_session_context.current[0].issuer_arn])
key_administrators = coalescelist(var.kms_key_administrators, [data.aws_iam_session_context.current.issuer_arn])
key_users = concat([local.cluster_role], var.kms_key_users)
key_service_users = var.kms_key_service_users
source_policy_documents = var.kms_key_source_policy_documents
Expand Down

0 comments on commit 93ffdfc

Please sign in to comment.