mirror of
https://github.com/ysoftdevs/terraform-aws-eks.git
synced 2026-03-21 17:09:04 +01:00
feat: Add EKS Fargate support (#1067)
Co-authored-by: Simon Gurcke <simon@gurcke.de> Co-authored-by: Daniel Piddock <33028589+dpiddockcmp@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
571da60aea
commit
0d77e30075
29
modules/fargate/fargate.tf
Normal file
29
modules/fargate/fargate.tf
Normal file
@@ -0,0 +1,29 @@
|
||||
resource "aws_iam_role" "eks_fargate_pod" {
|
||||
count = local.create_eks && var.create_fargate_pod_execution_role ? 1 : 0
|
||||
name_prefix = format("%s-fargate", var.cluster_name)
|
||||
assume_role_policy = data.aws_iam_policy_document.eks_fargate_pod_assume_role[0].json
|
||||
tags = var.tags
|
||||
path = var.iam_path
|
||||
}
|
||||
|
||||
resource "aws_iam_role_policy_attachment" "eks_fargate_pod" {
|
||||
count = local.create_eks && var.create_fargate_pod_execution_role ? 1 : 0
|
||||
policy_arn = "${var.iam_policy_arn_prefix}/AmazonEKSFargatePodExecutionRolePolicy"
|
||||
role = aws_iam_role.eks_fargate_pod[0].name
|
||||
}
|
||||
|
||||
resource "aws_eks_fargate_profile" "this" {
|
||||
for_each = local.create_eks ? local.fargate_profiles_expanded : {}
|
||||
cluster_name = var.cluster_name
|
||||
fargate_profile_name = lookup(each.value, "name", format("%s-fargate-%s", var.cluster_name, replace(each.key, "_", "-")))
|
||||
pod_execution_role_arn = local.pod_execution_role_arn
|
||||
subnet_ids = var.subnets
|
||||
tags = each.value.tags
|
||||
|
||||
selector {
|
||||
namespace = each.value.namespace
|
||||
labels = lookup(each.value, "labels", null)
|
||||
}
|
||||
|
||||
depends_on = [var.eks_depends_on]
|
||||
}
|
||||
Reference in New Issue
Block a user