From 1327fc3ec4f3d67ca2e34e0c621f0f263bc04897 Mon Sep 17 00:00:00 2001 From: Dipo Ajayi Date: Wed, 20 Nov 2024 16:15:41 +0100 Subject: [PATCH 1/2] Cap iam role prefix length --- iam.tf | 2 +- locals.tf | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/iam.tf b/iam.tf index f2a4488..dcc418f 100644 --- a/iam.tf +++ b/iam.tf @@ -193,7 +193,7 @@ resource "aws_iam_role" "truefoundry_platform_feature_iam_role" { count = var.platform_user_enabled ? 0 : 1 name = var.platform_role_enable_override ? var.platform_role_override_name : null description = "IAM role for TrueFoundry platform to access S3 bucket, SSM, ECR and EKS" - name_prefix = var.platform_role_enable_override ? null : "${local.truefoundry_unique_name}-iam-role-" + name_prefix = var.platform_role_enable_override ? null : local.iam_role_name_prefix force_detach_policies = true assume_role_policy = jsonencode({ diff --git a/locals.tf b/locals.tf index 8d09504..d13cd7e 100644 --- a/locals.tf +++ b/locals.tf @@ -18,4 +18,5 @@ locals { truefoundry_platform_policy_arns = [for arn in local.policy_arns : tostring(arn) if arn != null] oidc_provider_url = replace(data.aws_eks_cluster.cluster.identity[0].oidc[0].issuer, "https://", "") + iam_role_name_prefix = trimsuffix(substr("${local.truefoundry_unique_name}-iam-role-", 0, 37), "-") } From 6b75ad65e80cd7e14c4595059e5ab5f34234f804 Mon Sep 17 00:00:00 2001 From: Dipo Ajayi Date: Wed, 20 Nov 2024 16:16:39 +0100 Subject: [PATCH 2/2] Format terraform --- locals.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/locals.tf b/locals.tf index d13cd7e..f2eda4b 100644 --- a/locals.tf +++ b/locals.tf @@ -17,6 +17,6 @@ locals { ] truefoundry_platform_policy_arns = [for arn in local.policy_arns : tostring(arn) if arn != null] - oidc_provider_url = replace(data.aws_eks_cluster.cluster.identity[0].oidc[0].issuer, "https://", "") - iam_role_name_prefix = trimsuffix(substr("${local.truefoundry_unique_name}-iam-role-", 0, 37), "-") + oidc_provider_url = replace(data.aws_eks_cluster.cluster.identity[0].oidc[0].issuer, "https://", "") + iam_role_name_prefix = trimsuffix(substr("${local.truefoundry_unique_name}-iam-role-", 0, 37), "-") }