-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfargate.tf
More file actions
39 lines (32 loc) · 1005 Bytes
/
fargate.tf
File metadata and controls
39 lines (32 loc) · 1005 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
locals {
default_namespace = "default"
}
resource "aws_eks_fargate_profile" "this" {
cluster_name = aws_eks_cluster.this.name
fargate_profile_name = local.resource_name
pod_execution_role_arn = aws_iam_role.fargate.arn
subnet_ids = local.private_subnet_ids
tags = local.tags
selector {
namespace = local.default_namespace
}
}
resource "aws_iam_role" "fargate" {
name = "${local.resource_name}-fargate"
assume_role_policy = data.aws_iam_policy_document.fargate.json
tags = local.tags
}
data "aws_iam_policy_document" "fargate" {
statement {
effect = "Allow"
actions = ["sts:AssumeRole"]
principals {
type = "Service"
identifiers = ["eks-fargate-pods.amazonaws.com"]
}
}
}
resource "aws_iam_role_policy_attachment" "fargate_pod_execution" {
role = aws_iam_role.fargate.name
policy_arn = "arn:aws:iam::aws:policy/AmazonEKSFargatePodExecutionRolePolicy"
}