Commit e4232e64 authored by Cédric OLIVIER's avatar Cédric OLIVIER Committed by Pierre Smeyers
Browse files

feat: remove GitLab managed Terraform state on environment deletion

parent b3435885
Loading
Loading
Loading
Loading
+28 −22
Original line number Diff line number Diff line
@@ -462,6 +462,12 @@ stages:
    # shellcheck disable=SC2154,SC2086,SC2046
    terraform destroy -auto-approve $(echo "$extra_opts" | envsubst_cli) $(echo "$opts" | envsubst_cli)

    # remove gitlab-managed tf state
    if [[ "$TF_GITLAB_BACKEND_DISABLED" != "true" ]]
    then
      curl --header "Private-Token: ${TF_PASSWORD}" --request DELETE ${TF_ADDRESS}
    fi

    # maybe execute post destroy script
    postscript="$TF_SCRIPTS_DIR/tf-post-destroy.sh"
    if [[ -f "$postscript" ]]; then