Decommission a GCP Project

Guardrails allows you to remove a GCP project from a workspace. The delete action removes any associated policies and references in the database, but no resources are deleted from the target project. Think carefully when removing resources within the project -- once data is deleted (such as Pub/Sub topics and logging sinks), it cannot be retrieved.

Prerequisites

Step 1: Clean Up Guardrails Resources

Before you start the delete process, determine whether you want to keep Guardrails-managed resources in the project (such as Pub/Sub topics, subscriptions, and logging sinks). The following policies can be set at the GCP project level within Guardrails to facilitate cleanup. Be sure to verify that these policies are being set only on the project you intend to remove.

  1. Set GCP > Turbot > Permissions to Enforce: None. This removes Guardrails-managed roles and users in IAM.
  2. Set GCP > Turbot > Event Handlers > Logging to Enforce: Not configured. This removes the Guardrails-configured logging sink.
  3. Set GCP > Turbot > Event Handlers > Pub/Sub to Enforce: Not configured. This removes the Guardrails-created Pub/Sub topic and subscription.
  4. Set GCP > Turbot > Event Poller to Disabled. This disables the pulling of events into Guardrails.

Wait for the controls associated with these policies to complete before proceeding. You can use any combination of these policies to target specific resources while leaving important audit logging data available.

Step 2: Remove Credentials

Delete the GCP > Client Email and GCP > Private Key policies configured on the target project. Once they've been removed, the project can be deleted from the workspace.

Step 3: Delete the Project from Guardrails

  1. In the Guardrails console, navigate to the project you need to remove.
  2. Click the Actions menu (top right) and select Remove from Turbot. If you don't see this option, contact your Guardrails administrator for proper access.
  3. In the confirmation dialog, copy the project ID and paste it into the text box.
  4. Click Delete. While this action is not irreversible (you can reimport the project), it can be time and resource consuming. Double-check before confirming.
  5. Guardrails begins the delete process. The time to complete depends on the number of resources and policies being removed -- more resources means a longer process.

Error Handling

An error during project deletion may occur. The delete function is a complex SQL transaction, and failures in referential integrity or other blocking/locking database activity can cause it to fail.

If you encounter an error message:

  1. Ensure that all Guardrails event handlers for that project are removed so no new transactions are incoming.
  2. Remove the policy settings at the project level that contain the security credentials Guardrails uses to access the project.
  3. Try the deletion again. It may take several attempts.

If the deletion error persists for more than several hours after removing the event handlers, and you've verified that no project activity is taking place in the Activity tab, open a ticket with Turbot Support.

Next Steps