generated from terraform-ibm-modules/terraform-ibm-module-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.tf
132 lines (112 loc) · 3.13 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
data "ibm_container_cluster_config" "cluster_config" {
cluster_name_id = var.cluster_id
config_dir = "${path.module}/kubeconfig"
endpoint_type = var.cluster_config_endpoint_type != "default" ? var.cluster_config_endpoint_type : null
}
# Deploy helm chart to install selected deployment offerings namely, MAS Core or MAS Core+Manage
resource "helm_release" "maximo_helm_release" {
set_sensitive {
name = "entitlement_key"
type = "string"
value = base64encode(var.entitlement_key)
}
set_sensitive {
name = "mas_license"
type = "string"
value = base64encode(var.mas_license)
}
set {
name = "deployment_flavor"
type = "string"
value = var.deployment_flavor
}
set {
name = "mas_instance_id"
type = "string"
value = var.mas_instance_id
}
set {
name = "mas_workspace_id"
type = "string"
value = var.mas_workspace_id
}
set {
name = "mas_workspace_name"
type = "string"
value = var.mas_workspace_name
}
set {
name = "storage_class_rwo"
type = "string"
value = var.storage_class_rwo
}
set {
name = "storage_class_rwx"
type = "string"
value = var.storage_class_rwx
}
set {
name = "pipeline_storage_class"
type = "string"
value = var.pipeline_storage_class
}
set {
name = "contact_email"
type = "string"
value = var.contact_email
}
set {
name = "contact_firstname"
type = "string"
value = var.contact_firstname
}
set {
name = "contact_lastname"
type = "string"
value = var.contact_lastname
}
name = "maximo-helm-release"
chart = "${path.module}/chart/deploy-mas"
create_namespace = false
timeout = 1200
force_update = true
cleanup_on_fail = true
wait = true
recreate_pods = true
disable_openapi_validation = false
wait_for_jobs = true
}
locals {
admin_url_file = "${path.module}/url.txt"
}
# Verify the pipeline install status & get the the data on pipeline success status or in case of failure, get the data on failed task.
resource "null_resource" "install_verify" {
triggers = {
always_run = timestamp()
}
provisioner "local-exec" {
interpreter = ["/bin/bash", "-c"]
command = "${path.module}/scripts/installVerify.sh ${var.deployment_flavor} ${var.mas_instance_id}"
environment = {
KUBECONFIG = data.ibm_container_cluster_config.cluster_config.config_file_path
}
}
depends_on = [helm_release.maximo_helm_release]
}
resource "null_resource" "maximo_admin_url" {
triggers = {
always_run = timestamp()
}
provisioner "local-exec" {
interpreter = ["/bin/bash", "-c"]
command = "${path.module}/scripts/getAdminURL.sh ${var.mas_instance_id} ${local.admin_url_file}"
environment = {
KUBECONFIG = data.ibm_container_cluster_config.cluster_config.config_file_path
}
}
depends_on = [null_resource.install_verify]
}
data "local_file" "admin_url" {
depends_on = [null_resource.maximo_admin_url]
filename = local.admin_url_file
}