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_SKIP`.
If set to `true` the deployed environment will not be deleted during the
destroy step.

This PR fixes crosscloudci#163 and is related to crosscloudci#161; possibly crosscloudci#154.
  • Loading branch information
akutz committed Jul 16, 2018
1 parent 47bf02c commit 1317abc
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion provision.sh
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,12 @@ 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
VSPHERE_DESTROY_SKIP=${VSPHERE_DESTROY_SKIP:-${DESTROY_SKIP}}
if [ "${VSPHERE_DESTROY_SKIP}" = "true" ]; then
echo "vsphere environment destruction disabled"
else
time terraform destroy -force ${DIR}/vsphere || true
fi
# Exit after destroying resources as further commands cause hang
exit
fi
Expand Down

0 comments on commit 1317abc

Please sign in to comment.