-
Notifications
You must be signed in to change notification settings - Fork 3
/
kubernetes.tf
33 lines (27 loc) · 1.32 KB
/
kubernetes.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
# https://registry.terraform.io/providers/gavinbunney/kubectl/latest/docs/data-sources/kubectl_path_documents
data "kubectl_path_documents" "namespaces" {
pattern = "${var.project_dir}/manifests/namespaces/*.yaml"
}
# https://registry.terraform.io/providers/gavinbunney/kubectl/latest/docs/resources/kubectl_manifest
resource "kubectl_manifest" "namespaces" {
count = length(data.kubectl_path_documents.namespaces.documents)
yaml_body = element(data.kubectl_path_documents.namespaces.documents, count.index)
}
data "kubectl_path_documents" "secrets" {
# https://github.com/GrantBirki/k8s-discord/blob/main/terraform/k8s/modules/containers/frontend/deployment.tf
pattern = "${var.project_dir}/manifests/secrets/*.yaml"
vars = local.kubectl_vars
}
resource "kubectl_manifest" "secrets" {
# https://github.com/aruna-cande/gcp_infrastructure/blob/main/gke_manifests.tf
count = length(data.kubectl_path_documents.secrets.documents)
yaml_body = element(data.kubectl_path_documents.secrets.documents, count.index)
}
data "kubectl_path_documents" "jobs" {
pattern = "${var.project_dir}/manifests/jobs/*.yaml"
vars = local.kubectl_vars
}
resource "kubectl_manifest" "jobs" {
count = length(data.kubectl_path_documents.jobs.documents)
yaml_body = element(data.kubectl_path_documents.jobs.documents, count.index)
}