-
Notifications
You must be signed in to change notification settings - Fork 0
/
job-rbac.tf
39 lines (36 loc) · 821 Bytes
/
job-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
locals {
pod_template_configmap_name = "${var.name}-job-template"
}
resource "kubernetes_service_account" "job" {
metadata {
name = var.job_service_account_name
namespace = local.namespace
}
secret {
name = kubernetes_secret.job.metadata[0].name
}
}
resource "kubernetes_secret" "job" {
metadata {
name = var.job_service_account_name
namespace = local.namespace
}
}
resource "kubernetes_config_map" "job-template" {
metadata {
name = local.pod_template_configmap_name
namespace = local.namespace
}
data = {
"default.yml" = yamlencode({
apiVersion = "v1"
kind = "PodTemplate"
metadata = {
name = "runner-pod-template"
}
spec = {
serviceAccountName = var.job_service_account_name
}
})
}
}