| 1 | # Account-wide teardown for GCP resources stamped with alchemy-* labels. |
| 2 | # Requires GOOGLE_PROJECT_ID and either GOOGLE_ACCESS_TOKEN or |
| 3 | # GOOGLE_APPLICATION_CREDENTIALS (a service-account JSON key). |
| 4 | set -euo pipefail |
| 5 | |
| 6 | if [ -z "${GOOGLE_PROJECT_ID:-}" ] && [ -f "${HOME}/.config/gcloud/alchemy-project-id" ]; then |
| 7 | export GOOGLE_PROJECT_ID="$(cat "${HOME}/.config/gcloud/alchemy-project-id")" |
| 8 | fi |
| 9 | if [ -z "${GOOGLE_APPLICATION_CREDENTIALS:-}" ] && [ -f "${HOME}/.config/gcloud/alchemy-testing-sa.json" ]; then |
| 10 | export GOOGLE_APPLICATION_CREDENTIALS="${HOME}/.config/gcloud/alchemy-testing-sa.json" |
| 11 | fi |
| 12 | |
| 13 | bun alchemy unsafe nuke --config ./stacks/nuke-gcp.ts \ |
| 14 | --include 'GCP.*' \ |
| 15 | --profile alchemy-testing \ |
| 16 | --concurrency 16 \ |
| 17 | --timeout 300 \ |
| 18 | "$@" |