forked from cloud-native-toolkit/terraform-k8s-olm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
44 lines (37 loc) · 1.25 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
locals {
operator_namespace = var.cluster_type == "ocp4" ? "openshift-marketplace" : "olm"
target_namespace = var.cluster_type == "ocp4" ? "openshift-operators" : "operators"
}
data clis_check clis {
clis = ["kubectl","jq"]
}
resource "null_resource" "deploy_operator_lifecycle_manager" {
triggers = {
KUBECONFIG = var.cluster_config_file
CLUSTER_TYPE = var.cluster_type
CLUSTER_VERSION = var.cluster_version
OLM_VERSION = var.olm_version
BIN_DIR = data.clis_check.clis.bin_dir
}
provisioner "local-exec" {
command = "${path.module}/scripts/deploy-olm.sh ${self.triggers.OLM_VERSION}"
interpreter = ["bash", "-c"]
environment = {
KUBECONFIG = self.triggers.KUBECONFIG
CLUSTER_TYPE = self.triggers.CLUSTER_TYPE
CLUSTER_VERSION = self.triggers.CLUSTER_VERSION
BIN_DIR = self.triggers.BIN_DIR
}
}
provisioner "local-exec" {
when = destroy
command = "${path.module}/scripts/destroy-olm.sh"
#interpreter = ["bash"]
environment = {
KUBECONFIG = self.triggers.KUBECONFIG
CLUSTER_TYPE = self.triggers.CLUSTER_TYPE
CLUSTER_VERSION = self.triggers.CLUSTER_VERSION
BIN_DIR = self.triggers.BIN_DIR
}
}
}