diff --git a/examples/complete/main.tf b/examples/complete/main.tf index 920facd..6777788 100644 --- a/examples/complete/main.tf +++ b/examples/complete/main.tf @@ -309,7 +309,7 @@ locals { groups: - system:bootstrappers - system:nodes - - rolearn: ${module.fargate_profile.fargate_profile_arn} + - rolearn: ${module.fargate_profile.fargate_profile_pod_execution_role_arn} username: system:node:{{SessionName}} groups: - system:bootstrappers diff --git a/modules/fargate-profile/README.md b/modules/fargate-profile/README.md index 6851954..42349dd 100644 --- a/modules/fargate-profile/README.md +++ b/modules/fargate-profile/README.md @@ -81,6 +81,7 @@ No modules. |------|-------------| | [fargate\_profile\_arn](#output\_fargate\_profile\_arn) | Amazon Resource Name (ARN) of the EKS Fargate Profile | | [fargate\_profile\_id](#output\_fargate\_profile\_id) | EKS Cluster name and EKS Fargate Profile name separated by a colon (`:`) | +| [fargate\_profile\_pod\_execution\_role\_arn](#output\_fargate\_profile\_pod\_execution\_role\_arn) | Amazon Resource Name (ARN) of the EKS Fargate Profile Pod execution role ARN | | [fargate\_profile\_status](#output\_fargate\_profile\_status) | Status of the EKS Fargate Profile | | [iam\_role\_arn](#output\_iam\_role\_arn) | The Amazon Resource Name (ARN) specifying the IAM role | | [iam\_role\_name](#output\_iam\_role\_name) | The name of the IAM role | diff --git a/modules/fargate-profile/outputs.tf b/modules/fargate-profile/outputs.tf index bb6e023..0bf2edd 100644 --- a/modules/fargate-profile/outputs.tf +++ b/modules/fargate-profile/outputs.tf @@ -35,3 +35,8 @@ output "fargate_profile_status" { description = "Status of the EKS Fargate Profile" value = try(aws_eks_fargate_profile.this[0].status, "") } + +output "fargate_profile_pod_execution_role_arn" { + description = "Amazon Resource Name (ARN) of the EKS Fargate Profile Pod execution role ARN" + value = try(aws_eks_fargate_profile.this[0].pod_execution_role_arn, "") +} diff --git a/outputs.tf b/outputs.tf index 72ba73d..36799b2 100644 --- a/outputs.tf +++ b/outputs.tf @@ -165,10 +165,10 @@ output "aws_auth_configmap_yaml" { description = "Formatted yaml output for base aws-auth configmap containing roles used in cluster node groups/fargate profiles" value = templatefile("${path.module}/templates/aws_auth_cm.tpl", { - eks_managed_role_arns = [for group in module.eks_managed_node_group : group.iam_role_arn] - self_managed_role_arns = [for group in module.self_managed_node_group : group.iam_role_arn if group.platform != "windows"] - win32_self_managed_role_arns = [for group in module.self_managed_node_group : group.iam_role_arn if group.platform == "windows"] - fargate_profile_arns = [for group in module.fargate_profile : group.fargate_profile_arn] + eks_managed_role_arns = [for group in module.eks_managed_node_group : group.iam_role_arn] + self_managed_role_arns = [for group in module.self_managed_node_group : group.iam_role_arn if group.platform != "windows"] + win32_self_managed_role_arns = [for group in module.self_managed_node_group : group.iam_role_arn if group.platform == "windows"] + fargate_profile_pod_execution_role_arns = [for group in module.fargate_profile : group.fargate_profile_pod_execution_role_arn] } ) } diff --git a/templates/aws_auth_cm.tpl b/templates/aws_auth_cm.tpl index abf2102..73a898e 100644 --- a/templates/aws_auth_cm.tpl +++ b/templates/aws_auth_cm.tpl @@ -27,7 +27,7 @@ data: - system:bootstrappers - system:nodes %{ endfor ~} -%{ for role in fargate_profile_arns ~} +%{ for role in fargate_profile_pod_execution_role_arns ~} - rolearn: ${role} username: system:node:{{SessionName}} groups: