Skip to content

Commit 142f1f9

Browse files
committed
provider/vSphere: Make env destroy configurable
This patch introduces the environment variable `VSPHERE_DESTROY_ENABLED`. Unless set to `true`, an environment deployed to vSphere will not be destroyed during the deprovision step. This PR is related to crosscloudci#161 and possibly crosscloudci#154.
1 parent 47bf02c commit 142f1f9

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

provision.sh

+5-1
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,11 @@ elif [[ "$CLOUD_CMD" = "vsphere-deploy" || \
436436
terraform taint -module=kubeconfig null_resource.kubeconfig || true
437437
time terraform apply -auto-approve ${DIR}/vsphere
438438
elif [ "$CLOUD_CMD" = "vsphere-destroy" ] ; then
439-
time terraform destroy -force ${DIR}/vsphere || true
439+
if [ "${VSPHERE_DESTROY_ENABLED}" = "true" ]; then
440+
time terraform destroy -force ${DIR}/vsphere || true
441+
else
442+
echo "vsphere environment destruction disabled"
443+
fi
440444
# Exit after destroying resources as further commands cause hang
441445
exit
442446
fi

0 commit comments

Comments
 (0)