-
Notifications
You must be signed in to change notification settings - Fork 37
/
account.tf
78 lines (66 loc) · 1.62 KB
/
account.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
resource "kubernetes_namespace_v1" "monitoring" {
metadata {
annotations = {
name = "monitoring"
}
name = "monitoring"
}
}
resource "kubernetes_service_account_v1" "monitoring" {
metadata {
name = "monitoring"
namespace = kubernetes_namespace_v1.monitoring.metadata.0.name
}
secret {
name = "monitoring"
}
}
resource "kubernetes_secret_v1" "monitoring" {
depends_on = [
kubernetes_service_account_v1.monitoring
]
metadata {
name = "monitoring"
namespace = kubernetes_namespace_v1.monitoring.metadata.0.name
annotations = {
"kubernetes.io/service-account.name" = "monitoring"
"kubernetes.io/service-account.namespace" = "monitoring"
}
}
type = "kubernetes.io/service-account-token"
}
resource "kubernetes_cluster_role_v1" "monitoring" {
metadata {
name = "monitoring"
}
rule {
api_groups = [""]
resources = ["pods", "nodes", "secrets", "persistentvolumes"]
verbs = ["get", "list"]
}
rule {
api_groups = ["extensions", "apps"]
resources = ["deployments", "replicasets", "daemonsets", "statefulsets"]
verbs = ["get", "list"]
}
rule {
api_groups = ["batch"]
resources = ["jobs"]
verbs = ["get", "list"]
}
}
resource "kubernetes_cluster_role_binding_v1" "monitoring" {
metadata {
name = "monitoring"
}
role_ref {
api_group = "rbac.authorization.k8s.io"
kind = "ClusterRole"
name = "monitoring"
}
subject {
kind = "ServiceAccount"
name = "monitoring"
namespace = kubernetes_namespace_v1.monitoring.metadata.0.name
}
}