forked from thilinajayanath/terraform-eks-argocd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcm.tf
63 lines (57 loc) · 1.47 KB
/
cm.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
53
54
55
56
57
58
59
60
61
62
63
resource "kubernetes_config_map" "aws_auth" {
metadata {
name = "aws-auth"
namespace = "kube-system"
}
data = {
mapUsers = yamlencode([
{
userarn = data.aws_caller_identity.current.arn
username = element(split("/", data.aws_arn.current_user.resource), length(split("/", data.aws_arn.current_user.resource)) - 1)
groups = ["system:masters"]
},
])
mapRoles = yamlencode([
{
rolearn = "${aws_iam_role.eks_worker.arn}"
username = "system:node:{{EC2PrivateDNSName}}"
groups = [
"system:bootstrappers",
"system:nodes",
]
},
])
}
lifecycle {
ignore_changes = [data, metadata[0].labels, metadata[0].annotations]
}
}
resource "kubernetes_config_map_v1_data" "aws_auth" {
force = true
metadata {
name = "aws-auth"
namespace = "kube-system"
}
data = {
mapUsers = yamlencode([
{
userarn = data.aws_caller_identity.current.arn
username = element(split("/", data.aws_arn.current_user.resource), length(split("/", data.aws_arn.current_user.resource)) - 1)
groups = ["system:masters"]
},
])
mapRoles = yamlencode([
{
rolearn = "${aws_iam_role.eks_worker.arn}"
username = "system:node:{{EC2PrivateDNSName}}"
groups = [
"system:bootstrappers",
"system:nodes",
]
},
])
}
depends_on = [
kubernetes_config_map.aws_auth,
]
}