-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathiam-eks.tf
52 lines (49 loc) · 1.77 KB
/
iam-eks.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
52
data "aws_iam_policy_document" "svcfoundry_access_to_eks" {
statement {
effect = "Allow"
actions = [
"eks:ListNodegroups",
"eks:DescribeFargateProfile",
"eks:ListTagsForResource",
"eks:DescribeInsight",
"eks:ListAddons",
"eks:DescribeAddon",
"eks:DescribePodIdentityAssociation",
"eks:ListInsights",
"eks:ListPodIdentityAssociations",
"eks:ListFargateProfiles",
"eks:DescribeNodegroup",
"eks:ListUpdates",
"eks:DescribeUpdate",
"eks:AccessKubernetesApi",
"eks:DescribeCluster",
]
resources = [
"arn:aws:eks:${var.aws_region}:${var.aws_account_id}:fargateprofile/${var.cluster_name}/*/*",
"arn:aws:eks:${var.aws_region}:${var.aws_account_id}:addon/${var.cluster_name}/*/*",
"arn:aws:eks:${var.aws_region}:${var.aws_account_id}:nodegroup/${var.cluster_name}/*/*",
"arn:aws:eks:${var.aws_region}:${var.aws_account_id}:podidentityassociation/${var.cluster_name}/*",
"arn:aws:eks:${var.aws_region}:${var.aws_account_id}:identityproviderconfig/${var.cluster_name}/*/*/*",
"arn:aws:eks:${var.aws_region}:${var.aws_account_id}:cluster/${var.cluster_name}"
]
}
statement {
effect = "Allow"
actions = [
"eks:DescribeAddonConfiguration",
"eks:ListClusters",
"eks:DescribeAddonVersions",
"ec2:DescribeRegions"
]
resources = [
"*"
]
}
}
resource "aws_iam_policy" "svcfoundry_access_to_eks" {
count = var.truefoundry_iam_role_enabled ? 1 : 0
name_prefix = "${local.svcfoundry_unique_name}-access-to-eks"
description = "EKS read access for ${var.svcfoundry_k8s_service_account} on ${var.cluster_name}"
policy = data.aws_iam_policy_document.svcfoundry_access_to_eks.json
tags = local.tags
}