-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
manifests-bootstrap.tf
52 lines (47 loc) · 1.43 KB
/
manifests-bootstrap.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
# download and kustomize metrics server manifests
resource "synclocal_url" "metrics_server_manifest" {
url = local.metrics_server_manifest_url
filename = "${path.module}/manifests/metrics-server/metrics-server.yaml"
}
data "external" "kustomize_metrics-server" {
depends_on = [synclocal_url.metrics_server_manifest]
program = [
"go",
"run",
"${path.module}/cmd/kustomize",
"--",
"${path.module}/manifests/metrics-server",
]
}
# download and kustomize argocd manifests
resource "synclocal_url" "argocd_manifest" {
url = local.argocd_manifest_url
filename = "${path.module}/manifests/argocd/argocd.yaml"
}
# prepare the bootstrap manifests and write them in the output directory
data "external" "kustomize_bootstrap-manifests" {
depends_on = [
data.external.talos-nodes-ready,
synclocal_url.argocd_manifest,
]
for_each = {
for i, m in var.bootstrap_manifests: "bootstrap-manifest-${i}" => m
}
program = [
"go",
"run",
"${path.module}/cmd/kustomize",
"--",
"--enable-helm",
"-o",
"${path.module}/output/${each.key}.yaml",
"${path.module}/${each.value}",
]
}
resource "null_resource" "apply_bootstrap-manifests" {
depends_on = [data.external.kustomize_bootstrap-manifests]
for_each = data.external.kustomize_bootstrap-manifests
provisioner "local-exec" {
command = "kubectl apply --server-side=true -f ${path.module}/output/${each.key}.yaml"
}
}