diff --git a/modules/aws/EKS-Fargate-Profile/eks_fargate_profile.tf b/modules/aws/EKS-Fargate-Profile/eks_fargate_profile.tf index 405054b..83f6c9c 100644 --- a/modules/aws/EKS-Fargate-Profile/eks_fargate_profile.tf +++ b/modules/aws/EKS-Fargate-Profile/eks_fargate_profile.tf @@ -21,7 +21,7 @@ resource "aws_eks_fargate_profile" "eks_fargate_profile" { cluster_name = var.eks_cluster_name fargate_profile_name = var.fargate_profile_name - pod_execution_role_arn = var.fargate_iam_role_arn == null ? aws_iam_role.iam_role[0].arn : var.fargate_iam_role_arn + pod_execution_role_arn = aws_iam_role.iam_role.arn subnet_ids = var.subnet_ids tags = var.tags diff --git a/modules/aws/EKS-Fargate-Profile/iam_role.tf b/modules/aws/EKS-Fargate-Profile/iam_role.tf index 991a7b4..3e758fb 100644 --- a/modules/aws/EKS-Fargate-Profile/iam_role.tf +++ b/modules/aws/EKS-Fargate-Profile/iam_role.tf @@ -19,8 +19,7 @@ # -------------------------------------------------------------------------------------- resource "aws_iam_role" "iam_role" { - count = var.fargate_iam_role_arn != null ? 0 : 1 - name = join("-", [var.eks_cluster_name, var.fargate_profile_name, "eks-fargate-profile-iam-role"]) + name = join("-", [var.eks_cluster_name, var.fargate_profile_name, "eks-fargate-profile-iam-role"]) assume_role_policy = jsonencode({ Statement = [{ @@ -37,7 +36,7 @@ resource "aws_iam_role" "iam_role" { resource "aws_iam_role_policy_attachment" "amazon_eks_fargate_pod_execution_role_policy" { policy_arn = "arn:aws:iam::aws:policy/AmazonEKSFargatePodExecutionRolePolicy" - role = aws_iam_role.iam_role[0].name + role = aws_iam_role.iam_role.name depends_on = [ aws_iam_role.iam_role diff --git a/modules/aws/EKS-Fargate-Profile/variables.tf b/modules/aws/EKS-Fargate-Profile/variables.tf index 03c02a9..fca366a 100644 --- a/modules/aws/EKS-Fargate-Profile/variables.tf +++ b/modules/aws/EKS-Fargate-Profile/variables.tf @@ -18,12 +18,6 @@ # # -------------------------------------------------------------------------------------- -variable "fargate_iam_role_arn" { - description = "IAM role ARN to be associated with the fargate" - type = string - default = null -} - variable "eks_cluster_name" { description = "Name of the EKS cluster" type = string