CNE GCP Ready: Cleaning Up the Environment
Remove Cloud Native Experience (CNE) resources when you no longer need an environment to avoid unnecessary Google Cloud Platform (GCP) costs.
Manage infrastructure created through GitOps and Terraform using those workflows. Avoid modifying or deleting resources directly in the GCP console, as this can cause infrastructure state inconsistencies.
Clean up the environment in this order:
Tear Down Managed Infrastructure
Before removing the platform or cluster, delete the managed cloud resources created for your environments.
-
If your database uses deletion protection, disable it in
infrastructure.yaml:database: deletionProtection: false -
(Optional) Force-delete Cloud Storage bucket contents during teardown:
forceDestroy: trueIf you do not set this option, manually remove objects from Cloud Storage buckets before deletion.
-
Commit and push the change to your GitOps repository and allow Argo CD to synchronize the update.
-
Disable infrastructure for the environment:
enabled: false -
Commit and push the change.
-
Open Argo CD and synchronize the relevant
infraapplications with Prune enabled.
Cloud Native Experience uses Crossplane to remove the managed infrastructure resources during this process.
Wait until Argo CD shows that all infrastructure resources are deleted.
In some cases, GCP resources can remain after synchronization completes.
Verify remaining resources in the GCP console and remove them manually if necessary.
Common cases include Cloud SQL instances with deletion protection still enabled, Cloud Storage buckets that still contain objects, and KMS keys pending scheduled destruction.
Tear Down the CNE Platform
After all managed infrastructure is deleted, remove the platform resources.
-
From the CNE project directory, run:
cd gitops/resources terraform destroy --auto-approve -
After completion, remove the remaining platform components:
cd gitops/platform terraform destroy --auto-approve
Tear Down the GKE Cluster
Finally, delete the GKE cluster:
cd gke
terraform destroy --auto-approve
After the command finishes, verify in the GCP console that the GKE cluster and related resources have been removed.