-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathrbac.tf
88 lines (77 loc) · 1.92 KB
/
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
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
resource "kubernetes_cluster_role" "this" {
count = var.rbac_create ? 1 : 0
metadata {
name = local.cluster_role_name
labels = {
terrafrom = "true"
app = var.name
}
}
rule {
api_groups = [""]
resources = ["endpoints", "namespaces", "secrets", "services"]
verbs = ["get", "list", "watch"]
}
rule {
api_groups = ["getambassador.io"]
resources = ["*"]
verbs = ["get", "list", "watch"]
}
rule {
api_groups = ["apiextensions.k8s.io"]
resources = ["customresourcedefinitions"]
verbs = ["get", "list", "watch"]
}
rule {
api_groups = ["networking.internal.knative.dev"]
resources = ["clusteringresses", "ingresses"]
verbs = ["get", "list", "watch"]
}
rule {
api_groups = ["networking.internal.knative.dev"]
resources = ["ingresses/status", "clusteringresses/status"]
verbs = ["update"]
}
rule {
api_groups = ["extensions", "networking.k8s.io"]
resources = ["ingressclasses", "ingresses"]
verbs = ["get", "list", "watch"]
}
rule {
api_groups = ["extensions"]
resources = ["ingresses/status"]
verbs = ["update"]
}
rule {
api_groups = [""]
resources = ["configmaps"]
verbs = ["create", "update", "patch", "get", "list", "watch"]
}
}
resource "kubernetes_cluster_role_binding" "this" {
count = var.rbac_create ? 1 : 0
lifecycle {
ignore_changes = [subject.0.api_group]
}
metadata {
name = local.cluster_role_name
labels = {
terrafrom = "true"
app = var.name
}
}
role_ref {
api_group = "rbac.authorization.k8s.io"
name = local.cluster_role_name
kind = "ClusterRole"
}
subject {
kind = "ServiceAccount"
name = local.service_account_name
namespace = var.namespace_name
}
depends_on = [
kubernetes_namespace.this,
kubernetes_cluster_role.this,
]
}