-
Notifications
You must be signed in to change notification settings - Fork 1
/
example.tf
55 lines (46 loc) · 1.54 KB
/
example.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
##############################################################################
# Example usage of portworx
##############################################################################
resource kubernetes_persistent_volume_claim example {
metadata {
name = "${var.unique_id}-example-pvc"
}
spec {
access_modes = ["ReadWriteOnce"]
resources {
requests = {
storage = "10Gi"
}
}
storage_class_name = "portworx-shared-sc"
}
depends_on = [ibm_resource_instance.portworx]
}
resource null_resource deployment {
triggers = {
deployment_label = var.unique_id
image_name = var.image_name
file_path = var.file_path
}
provisioner "local-exec" {
environment = {
DEPLOYMENT_LABEL = self.triggers.deployment_label
IMAGE_NAME = self.triggers.image_name
FILE_PATH = self.triggers.file_path
CONFIGPATH = data.ibm_container_cluster_config.cluster.config_file_path
PVC_NAME = kubernetes_persistent_volume_claim.example.metadata.0.name
}
interpreter = ["/bin/bash", "-c"]
command = file("${path.root}/scripts/deployment.sh")
}
provisioner "local-exec" {
when = destroy
environment = {
DEPLOYMENT_LABEL = self.triggers.deployment_label
CONFIGPATH = data.ibm_container_cluster_config.cluster.config_file_path
}
interpreter = ["/bin/bash", "-c"]
command = file("${path.root}/scripts/deployment_destroy.sh")
}
}
##############################################################################