-
Notifications
You must be signed in to change notification settings - Fork 0
/
cluster_role.tf
65 lines (57 loc) · 1.42 KB
/
cluster_role.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
64
65
resource "kubernetes_cluster_role" "nginx_ingress" {
metadata {
name = local.app_name
labels = local.labels
}
rule {
api_groups = [""]
resources = ["configmaps", "endpoints", "nodes", "pods", "secrets"]
verbs = ["list", "watch"]
}
rule {
api_groups = [""]
resources = ["nodes"]
verbs = ["get"]
}
rule {
api_groups = [""]
resources = ["services"]
verbs = ["get", "list", "watch"]
}
rule {
api_groups = ["extensions", "networking.k8s.io"]
resources = ["ingresses"]
verbs = ["get", "list", "watch"]
}
rule {
api_groups = [""]
resources = ["events"]
verbs = ["create", "patch"]
}
rule {
api_groups = ["extensions", "networking.k8s.io"]
resources = ["ingresses/status"]
verbs = ["update"]
}
rule {
api_groups = ["networking.k8s.io"]
resources = ["ingressclasses"]
verbs = ["get", "list", "watch"]
}
}
resource "kubernetes_cluster_role_binding" "nginx_ingress" {
metadata {
name = local.app_name
labels = local.labels
}
role_ref {
api_group = "rbac.authorization.k8s.io"
kind = "ClusterRole"
name = kubernetes_cluster_role.nginx_ingress.id
}
subject {
kind = "ServiceAccount"
name = kubernetes_service_account.nginx_ingress.metadata.0.name
namespace = kubernetes_service_account.nginx_ingress.metadata.0.namespace
}
}