-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
82 lines (70 loc) · 2.21 KB
/
main.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
resource "kubernetes_namespace_v1" "pipelines" {
metadata {
name = "tekton-pipelines"
}
lifecycle {
ignore_changes = [metadata[0].labels]
}
}
resource "kubernetes_namespace_v1" "resolvers" {
metadata {
name = "tekton-pipelines-resolvers"
}
lifecycle {
ignore_changes = [metadata[0].labels]
}
}
resource "kubernetes_namespace_v1" "pac" {
metadata {
name = "pipelines-as-code"
}
lifecycle {
ignore_changes = [metadata[0].labels]
}
}
locals {
pipelines_version = var.pipelines_version == null ? "latest" : "previous/v${var.pipelines_version}"
dashboard_version = var.dashboard_version == null ? "latest" : "previous/v${var.dashboard_version}"
pac_url = var.pac_version == null ?
"https://raw.githubusercontent.com/openshift-pipelines/pipelines-as-code/stable/release.k8s.yaml" :
"https://github.com/openshift-pipelines/pipelines-as-code/releases/download/${var.pac_version}/release.k8s.yaml"
}
data "http" "pipelines" {
url = "https://storage.googleapis.com/tekton-releases/pipeline/${local.pipelines_version}/release.yaml"
}
data "kubectl_file_documents" "pipelines" {
content = data.http.pipelines.response_body
}
resource "kubectl_manifest" "pipelines" {
depends_on = [
kubernetes_namespace_v1.pipelines,
kubernetes_namespace_v1.resolvers
]
for_each = data.kubectl_file_documents.pipelines.manifests
yaml_body = each.value
}
data "http" "dashboard" {
url = "https://storage.googleapis.com/tekton-releases/dashboard/${local.dashboard_version}/release.yaml"
}
data "kubectl_file_documents" "dashboard" {
content = data.http.dashboard.response_body
}
resource "kubectl_manifest" "dashboard" {
depends_on = [kubectl_manifest.pipelines]
for_each = data.kubectl_file_documents.dashboard.manifests
yaml_body = each.value
}
data "http" "pac" {
url = local.pac_url
}
data "kubectl_file_documents" "pac" {
content = data.http.pac.response_body
}
resource "kubectl_manifest" "pac" {
depends_on = [
kubernetes_namespace_v1.pac,
kubectl_manifest.pipelines
]
for_each = data.kubectl_file_documents.pac.manifests
yaml_body = each.value
}