Skip to content

Platform Teardown

This guide provides a structured process for decommissioning a Nexus SDV instance. Using the automated teardown-platform.sh script, you can securely remove infrastructure while having the option to preserve specific core components for future use.

  1. Verify Identity Ensure you are using the same Google Cloud project and GitHub repository that was used for the initial bootstrapping.

  2. Execute Teardown Run the decommissioning script from your terminal: bash ./iac/bootstrapping/teardown-platform.sh

  3. Verify Cleanup Confirm that the resources have been removed from the GCP Console and your environment is in the desired state.

The teardown process requires the same environment stability as the deployment.

Ensure these tools are installed and authenticated before starting:

ToolPurpose
Google Cloud CLIRemoving GCP resources and Secret Manager entries.
GitHub CLI (gh)Deleting environment variables and cleaning up repository states.
Terraform CLIExecuting the terraform destroy command for infrastructure removal.
jqProcessing JSON-based environment data from GitHub.

To initiate the decommissioning, execute the script from the project’s root directory:

Terminal window
$ bash iac/bootstrapping/teardown-platform.sh

To target the correct resources, the script will prompt you for:

  1. GitHub Repository Notation (GITHUB_REPO): e.g., owner/repo.
  2. GitHub Environment (ENV): The name used during bootstrap (max. 15 chars).

During the process, the script will ask whether to delete or preserve specific resources. For PoC environments, we recommend a “soft” teardown:

The script asks if you want to preserve your Certificate Authority Pools.

  • Recommendation: Preserve them (Type ‘y’).
  • Why: GCP CA Pools have a 30-day recovery period. Keeping them prevents naming conflicts and makes redeploying the platform much faster and more resource-efficient.

At the end, you are asked whether to delete the local configuration file.

  • Recommendation: Do NOT delete (Type ‘n’).
  • Why: This file contains your project configuration. Keeping it allows you to restart the platform later without re-entering all IDs and regions.

Once started, the script performs a coordinated cleanup across three main layers:

Specific resources, such as GKE workloads, are terminated first to ensure a clean state and free up database connections.

The script executes terraform destroy. This removes the GKE cluster, BigTable instances, and networking components. Note that CA pools and APIs are often removed from the state instead of being deleted to avoid recovery locks.

In the final stage, the script:

  • Deletes the Cloud Storage bucket containing the Terraform state.
  • Clears non-essential GitHub Environment variables.
  • Wipes entries from the GCP Secret Manager.

A successful teardown is confirmed by the following message:

Nexus SDV platform teardown successfully completed! 🧹

ServiceExpected State
GKENo active clusters related to the environment.
Cloud StorageThe [gcp-project-name]-tfstate bucket has been removed.
Secret ManagerEnvironment-specific secrets are deleted.