-
Notifications
You must be signed in to change notification settings - Fork 0
/
iam.tf
51 lines (49 loc) · 1.67 KB
/
iam.tf
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
39
40
41
42
43
44
45
46
47
48
49
50
51
module "load_balancer_controller_irsa_role" {
source = "terraform-aws-modules/iam/aws//modules/iam-role-for-service-accounts-eks"
role_name = "load-balancer-controller"
attach_load_balancer_controller_policy = true
oidc_providers = {
ex = {
provider_arn = module.eks.oidc_provider_arn
namespace_service_accounts = ["kube-system:aws-load-balancer-controller"]
}
}
}
resource "aws_iam_policy" "eks_nlb_create_policy" {
name = "eks-nlb-create-policy"
description = "Policy for EKS NLB creation"
policy = jsonencode({
Version = "2012-10-17"
Statement = [
{
Sid = "kopsK8sNLBMasterPermsRestrictive"
Effect = "Allow"
Action = [
"ec2:DescribeVpcs",
"elasticloadbalancing:AddTags",
"elasticloadbalancing:CreateListener",
"elasticloadbalancing:CreateTargetGroup",
"elasticloadbalancing:DeleteListener",
"elasticloadbalancing:DeleteTargetGroup",
"elasticloadbalancing:DescribeListeners",
"elasticloadbalancing:DescribeLoadBalancerPolicies",
"elasticloadbalancing:DescribeTargetGroups",
"elasticloadbalancing:DescribeTargetHealth",
"elasticloadbalancing:ModifyListener",
"elasticloadbalancing:ModifyTargetGroup",
"elasticloadbalancing:RegisterTargets",
"elasticloadbalancing:SetLoadBalancerPoliciesOfListener",
]
Resource = ["*"]
},
{
Effect = "Allow"
Action = [
"ec2:DescribeVpcs",
"ec2:DescribeRegions",
]
Resource = "*"
},
]
})
}