Skip to content

Commit

Permalink
provider/vSphere: Make env destroy configurable
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
akutz committed Jul 16, 2018
1 parent 47bf02c commit 142f1f9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion provision.sh
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,11 @@ elif [[ "$CLOUD_CMD" = "vsphere-deploy" || \
terraform taint -module=kubeconfig null_resource.kubeconfig || true
time terraform apply -auto-approve ${DIR}/vsphere
elif [ "$CLOUD_CMD" = "vsphere-destroy" ] ; then
time terraform destroy -force ${DIR}/vsphere || true
if [ "${VSPHERE_DESTROY_ENABLED}" = "true" ]; then
time terraform destroy -force ${DIR}/vsphere || true
else
echo "vsphere environment destruction disabled"
fi
# Exit after destroying resources as further commands cause hang
exit
fi
Expand Down

0 comments on commit 142f1f9

Please sign in to comment.