From faeb3103b511c9255a945e3910e912690c98613b Mon Sep 17 00:00:00 2001 From: Nilesh Gadgi Date: Wed, 27 Sep 2023 22:40:43 +0530 Subject: [PATCH] fix: update naming conevension for policy and IAM name (#31) Co-authored-by: Anmol Nagpal <4303310+anmolnagpal@users.noreply.github.com> --- addons/aws-ebs-csi-driver/main.tf | 2 +- addons/aws-efs-csi-driver/main.tf | 4 ++-- addons/aws-efs-csi-driver/outputs.tf | 2 +- addons/aws-load-balancer-controller/main.tf | 4 ++-- addons/aws-load-balancer-controller/outputs.tf | 2 +- addons/cluster-autoscaler/main.tf | 4 ++-- addons/cluster-autoscaler/outputs.tf | 2 +- addons/external-secrets/main.tf | 4 ++-- addons/external-secrets/outputs.tf | 2 +- addons/fluent-bit/main.tf | 4 ++-- addons/fluent-bit/outputs.tf | 2 +- addons/karpenter/main.tf | 4 ++-- addons/karpenter/outputs.tf | 2 +- addons/velero/main.tf | 4 ++-- addons/velero/outputs.tf | 2 +- 15 files changed, 22 insertions(+), 22 deletions(-) diff --git a/addons/aws-ebs-csi-driver/main.tf b/addons/aws-ebs-csi-driver/main.tf index d7c5420..2c4b451 100644 --- a/addons/aws-ebs-csi-driver/main.tf +++ b/addons/aws-ebs-csi-driver/main.tf @@ -20,7 +20,7 @@ module "helm_addon" { # -- IRSA Configurations irsa_config = { irsa_iam_policies = [aws_iam_policy.policy.arn] - irsa_iam_role_name = "${local.name}-${var.eks_cluster_name}-IAM-Role" + irsa_iam_role_name = "${local.name}-${var.eks_cluster_name}" create_kubernetes_service_account = true kubernetes_service_account = "${local.name}-sa" kubernetes_namespace = local.default_helm_config.namespace diff --git a/addons/aws-efs-csi-driver/main.tf b/addons/aws-efs-csi-driver/main.tf index 07a52a8..905822e 100644 --- a/addons/aws-efs-csi-driver/main.tf +++ b/addons/aws-efs-csi-driver/main.tf @@ -28,7 +28,7 @@ module "helm_addon" { # -- IRSA Configurations irsa_config = { irsa_iam_policies = [aws_iam_policy.policy.arn] - irsa_iam_role_name = "${local.name}-${var.eks_cluster_name}-IAM-Role" + irsa_iam_role_name = "${local.name}-${var.eks_cluster_name}" create_kubernetes_service_account = true kubernetes_service_account = "${local.name}-sa" kubernetes_namespace = local.default_helm_config.namespace @@ -39,7 +39,7 @@ module "helm_addon" { } resource "aws_iam_policy" "policy" { - name = "${local.name}-${var.eks_cluster_name}-IAM-Policy" + name = "${local.name}-${var.eks_cluster_name}" path = "/" description = "IAM Policy used by ${local.name}-${var.eks_cluster_name} IAM Role" policy = var.iampolicy_json_content != null ? var.iampolicy_json_content : <<-EOT diff --git a/addons/aws-efs-csi-driver/outputs.tf b/addons/aws-efs-csi-driver/outputs.tf index 8f744a2..1e0e671 100644 --- a/addons/aws-efs-csi-driver/outputs.tf +++ b/addons/aws-efs-csi-driver/outputs.tf @@ -3,7 +3,7 @@ output "service_account" { } output "iam_policy" { - value = "${local.name}-${var.eks_cluster_name}-IAM-Policy" + value = "${local.name}-${var.eks_cluster_name}" } output "namespace" { diff --git a/addons/aws-load-balancer-controller/main.tf b/addons/aws-load-balancer-controller/main.tf index 9fbded6..83b168e 100644 --- a/addons/aws-load-balancer-controller/main.tf +++ b/addons/aws-load-balancer-controller/main.tf @@ -32,7 +32,7 @@ module "helm_addon" { # -- IRSA Configurations irsa_config = { irsa_iam_policies = [aws_iam_policy.policy.arn] - irsa_iam_role_name = "${local.name}-${var.eks_cluster_name}-IAM-Role" + irsa_iam_role_name = "${local.name}-${var.eks_cluster_name}" create_kubernetes_service_account = true kubernetes_service_account = "${local.name}-sa" kubernetes_namespace = local.default_helm_config.namespace @@ -43,7 +43,7 @@ module "helm_addon" { } resource "aws_iam_policy" "policy" { - name = "${local.name}-${var.eks_cluster_name}-IAM-Policy" + name = "${local.name}-${var.eks_cluster_name}" path = "/" description = "IAM Policy used by ${local.name}-${var.eks_cluster_name} IAM Role" policy = var.iampolicy_json_content != null ? var.iampolicy_json_content : <<-EOT diff --git a/addons/aws-load-balancer-controller/outputs.tf b/addons/aws-load-balancer-controller/outputs.tf index 8f744a2..1e0e671 100644 --- a/addons/aws-load-balancer-controller/outputs.tf +++ b/addons/aws-load-balancer-controller/outputs.tf @@ -3,7 +3,7 @@ output "service_account" { } output "iam_policy" { - value = "${local.name}-${var.eks_cluster_name}-IAM-Policy" + value = "${local.name}-${var.eks_cluster_name}" } output "namespace" { diff --git a/addons/cluster-autoscaler/main.tf b/addons/cluster-autoscaler/main.tf index 1797732..1e008bd 100644 --- a/addons/cluster-autoscaler/main.tf +++ b/addons/cluster-autoscaler/main.tf @@ -28,7 +28,7 @@ module "helm_addon" { # -- IRSA Configurations irsa_config = { irsa_iam_policies = [aws_iam_policy.policy.arn] - irsa_iam_role_name = "${local.name}-${var.eks_cluster_name}-IAM-Role" + irsa_iam_role_name = "${local.name}-${var.eks_cluster_name}" create_kubernetes_service_account = true kubernetes_service_account = "${local.name}-sa" kubernetes_namespace = local.default_helm_config.namespace @@ -38,7 +38,7 @@ module "helm_addon" { } resource "aws_iam_policy" "policy" { - name = "${local.name}-${var.eks_cluster_name}-IAM-Policy" + name = "${local.name}-${var.eks_cluster_name}" path = "/" description = "IAM Policy used by ${local.name}-${var.eks_cluster_name} IAM Role" policy = var.iampolicy_json_content != null ? var.iampolicy_json_content : <<-EOT diff --git a/addons/cluster-autoscaler/outputs.tf b/addons/cluster-autoscaler/outputs.tf index 8f744a2..1e0e671 100644 --- a/addons/cluster-autoscaler/outputs.tf +++ b/addons/cluster-autoscaler/outputs.tf @@ -3,7 +3,7 @@ output "service_account" { } output "iam_policy" { - value = "${local.name}-${var.eks_cluster_name}-IAM-Policy" + value = "${local.name}-${var.eks_cluster_name}" } output "namespace" { diff --git a/addons/external-secrets/main.tf b/addons/external-secrets/main.tf index 2086a5a..a9beddb 100644 --- a/addons/external-secrets/main.tf +++ b/addons/external-secrets/main.tf @@ -37,7 +37,7 @@ module "helm_addon" { # -- IRSA Configurations irsa_config = { irsa_iam_policies = [aws_iam_policy.policy.arn] - irsa_iam_role_name = "${local.name}-${var.eks_cluster_name}-IAM-Role" + irsa_iam_role_name = "${local.name}-${var.eks_cluster_name}" create_kubernetes_service_account = true kubernetes_service_account = "${local.name}-sa" kubernetes_namespace = local.default_helm_config.namespace @@ -48,7 +48,7 @@ module "helm_addon" { } resource "aws_iam_policy" "policy" { - name = "${local.name}-${var.eks_cluster_name}-IAM-Policy" + name = "${local.name}-${var.eks_cluster_name}" path = "/" description = "IAM Policy used by ${local.name}-${var.eks_cluster_name} IAM Role" policy = data.aws_iam_policy_document.iam-policy.json diff --git a/addons/external-secrets/outputs.tf b/addons/external-secrets/outputs.tf index e0b97fd..50a752d 100644 --- a/addons/external-secrets/outputs.tf +++ b/addons/external-secrets/outputs.tf @@ -7,7 +7,7 @@ output "service_account" { } output "iam_policy" { - value = "${local.name}-${var.eks_cluster_name}-IAM-Policy" + value = "${local.name}-${var.eks_cluster_name}" } output "namespace" { diff --git a/addons/fluent-bit/main.tf b/addons/fluent-bit/main.tf index 86f522f..450c269 100644 --- a/addons/fluent-bit/main.tf +++ b/addons/fluent-bit/main.tf @@ -31,7 +31,7 @@ module "helm_addon" { # -- IRSA Configurations irsa_config = { irsa_iam_policies = [aws_iam_policy.policy.arn] - irsa_iam_role_name = "${local.name}-${var.eks_cluster_name}-IAM-Role" + irsa_iam_role_name = "${local.name}-${var.eks_cluster_name}" create_kubernetes_service_account = true kubernetes_service_account = "${local.name}-sa" kubernetes_namespace = local.default_helm_config.namespace @@ -42,7 +42,7 @@ module "helm_addon" { } resource "aws_iam_policy" "policy" { - name = "${local.name}-${var.eks_cluster_name}-IAM-Policy" + name = "${local.name}-${var.eks_cluster_name}" path = "/" description = "IAM Policy used by ${local.name}-${var.eks_cluster_name} IAM Role" policy = var.iampolicy_json_content != null ? var.iampolicy_json_content : <<-EOT diff --git a/addons/fluent-bit/outputs.tf b/addons/fluent-bit/outputs.tf index 8f744a2..1e0e671 100644 --- a/addons/fluent-bit/outputs.tf +++ b/addons/fluent-bit/outputs.tf @@ -3,7 +3,7 @@ output "service_account" { } output "iam_policy" { - value = "${local.name}-${var.eks_cluster_name}-IAM-Policy" + value = "${local.name}-${var.eks_cluster_name}" } output "namespace" { diff --git a/addons/karpenter/main.tf b/addons/karpenter/main.tf index 2b00b28..7cd29c1 100644 --- a/addons/karpenter/main.tf +++ b/addons/karpenter/main.tf @@ -32,7 +32,7 @@ module "helm_addon" { # -- IRSA Configurations irsa_config = { irsa_iam_policies = [aws_iam_policy.policy.arn] - irsa_iam_role_name = "${local.name}-${var.eks_cluster_name}-IAM-Role" + irsa_iam_role_name = "${local.name}-${var.eks_cluster_name}" create_kubernetes_service_account = true kubernetes_service_account = "${local.name}-sa" kubernetes_namespace = local.default_helm_config.namespace @@ -43,7 +43,7 @@ module "helm_addon" { } resource "aws_iam_policy" "policy" { - name = "${local.name}-${var.eks_cluster_name}-IAM-Policy" + name = "${local.name}-${var.eks_cluster_name}" path = "/" description = "IAM Policy used by ${local.name}-${var.eks_cluster_name} IAM Role" policy = var.iampolicy_json_content != null ? var.iampolicy_json_content : <<-EOT diff --git a/addons/karpenter/outputs.tf b/addons/karpenter/outputs.tf index 8f744a2..1e0e671 100644 --- a/addons/karpenter/outputs.tf +++ b/addons/karpenter/outputs.tf @@ -3,7 +3,7 @@ output "service_account" { } output "iam_policy" { - value = "${local.name}-${var.eks_cluster_name}-IAM-Policy" + value = "${local.name}-${var.eks_cluster_name}" } output "namespace" { diff --git a/addons/velero/main.tf b/addons/velero/main.tf index e76c47f..ce7c0ac 100644 --- a/addons/velero/main.tf +++ b/addons/velero/main.tf @@ -27,13 +27,13 @@ module "helm_addon" { kubernetes_namespace = local.default_helm_config.namespace kubernetes_service_account = "${local.name}-sa" irsa_iam_policies = [aws_iam_policy.policy.arn] - irsa_iam_role_name = "${local.name}-${var.eks_cluster_name}-IAM-Role" + irsa_iam_role_name = "${local.name}-${var.eks_cluster_name}" eks_oidc_provider_arn = replace(data.aws_eks_cluster.eks_cluster.identity[0].oidc[0].issuer, "https://", "") account_id = var.account_id } } resource "aws_iam_policy" "policy" { - name = "${local.name}-${var.eks_cluster_name}-IAM-Policy" + name = "${local.name}-${var.eks_cluster_name}" path = "/" description = "IAM Policy used by ${local.name}-${var.eks_cluster_name} IAM Role" policy = var.iampolicy_json_content != null ? var.iampolicy_json_content : <<-EOT diff --git a/addons/velero/outputs.tf b/addons/velero/outputs.tf index 8f744a2..1e0e671 100644 --- a/addons/velero/outputs.tf +++ b/addons/velero/outputs.tf @@ -3,7 +3,7 @@ output "service_account" { } output "iam_policy" { - value = "${local.name}-${var.eks_cluster_name}-IAM-Policy" + value = "${local.name}-${var.eks_cluster_name}" } output "namespace" {