diff --git a/modules/iam-assumable-role/main.tf b/modules/iam-assumable-role/main.tf index f4405b19..4176b8f9 100644 --- a/modules/iam-assumable-role/main.tf +++ b/modules/iam-assumable-role/main.tf @@ -55,6 +55,15 @@ data "aws_iam_policy_document" "assume_role" { values = local.role_sts_externalid } } + + dynamic "condition" { + for_each = var.role_requires_session_name ? [1] : [] + content { + test = "StringEquals" + variable = "sts:RoleSessionName" + values = var.role_session_name + } + } } }