-
Notifications
You must be signed in to change notification settings - Fork 28
/
node-rbac.tf
40 lines (35 loc) · 887 Bytes
/
node-rbac.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
resource "kubernetes_service_account" "node" {
metadata {
name = local.daemonset_name
namespace = var.namespace
labels = var.labels
}
automount_service_account_token = true
}
resource "kubernetes_cluster_role" "node" {
metadata {
name = "ebs-csi-node-role"
labels = var.labels
}
rule {
api_groups = [""]
resources = ["nodes"]
verbs = ["get"]
}
}
resource "kubernetes_cluster_role_binding" "node" {
metadata {
name = "ebs-csi-node-getter-binding"
labels = var.labels
}
role_ref {
api_group = "rbac.authorization.k8s.io"
kind = "ClusterRole"
name = kubernetes_cluster_role.node.metadata[0].name
}
subject {
kind = "ServiceAccount"
name = kubernetes_service_account.node.metadata[0].name
namespace = kubernetes_service_account.node.metadata[0].namespace
}
}