Stay organized with collections
Save and categorize content based on your preferences.
This page describes how to use Infrastructure Manager to preview the deletion of an
existing deployment.
A preview describes the actions to actuate a specific Terraform configuration.
Before you delete a deployment, you can use a preview to verify the resources
that are planned to be deleted.
A preview does not delete any provisioned resources. To delete a deployment,
including deleting provisioned resources, see
Delete deployments.
A preview executes the Terraform plan command. This page assumes you are
familiar with Terraform. For details, see
Terraform and Infrastructure Manager.
Identify the Terraform configuration to preview. Ensure this Terraform
configuration complies with the constraints,
including that the configuration does not contain sensitive data.
If you want to store the Terraform configuration in a storage bucket, ensure
the Terraform configuration is uploaded to a Cloud Storage bucket. See
Upload a configuration to a storage bucket
for more details.
A storage bucket lets you control access to the configuration. You
can also deploy a Terraform configuration that is stored in a
public Git repository, or stored on your
local machine.
Preview the deletion of a deployment
Before you delete a deployment, you can preview and review the deletion.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-25 UTC."],[[["\u003cp\u003eThis page guides users on how to use Infrastructure Manager to preview the deletion of an existing deployment, using a process that does not delete any provisioned resources.\u003c/p\u003e\n"],["\u003cp\u003ePreviews utilize the \u003ccode\u003eTerraform plan\u003c/code\u003e command, requiring users to have prior familiarity with Terraform and its configuration, in order to see the actions necessary to actuate it.\u003c/p\u003e\n"],["\u003cp\u003eBefore initiating a preview, you must have the correct IAM permissions (\u003ccode\u003eroles/config.admin\u003c/code\u003e) and a service account properly configured with the necessary permissions.\u003c/p\u003e\n"],["\u003cp\u003eTo preview the deletion of a deployment, use the gcloud command \u003ccode\u003einfra-manager previews create\u003c/code\u003e with the \u003ccode\u003e--preview-mode DELETE\u003c/code\u003e flag, specifying the relevant project, location, deployment, and service account details.\u003c/p\u003e\n"],["\u003cp\u003eAfter a preview is created, you can export and view the results, allowing you to review the plan for the deployment before proceeding with an actual deletion, which is covered in a separate document.\u003c/p\u003e\n"]]],[],null,["# Preview a deletion of a deployment\n\nThis page describes how to use Infrastructure Manager to preview the deletion of an\nexisting deployment.\n\nA preview describes the actions to actuate a specific Terraform configuration.\nBefore you delete a deployment, you can use a preview to verify the resources\nthat are planned to be deleted.\n\nA preview does not delete any provisioned resources. To delete a deployment,\nincluding deleting provisioned resources, see\n[Delete deployments](/infrastructure-manager/docs/delete-deployments).\n\nA preview executes the `Terraform plan` command. This page assumes you are\nfamiliar with Terraform. For details, see\n[Terraform and Infrastructure Manager](/infrastructure-manager/docs/terraform).\n\nBefore you begin\n----------------\n\n1. [Enable Infra Manager](/infrastructure-manager/docs/enable-service).\n2. Ensure that you have the IAM permissions needed to create previews: `roles/config.admin`.\n3. Ensure you have a service account with the needed permissions. For details, see [Configure the service account](/infrastructure-manager/docs/configure-service-account).\n4. Identify the Terraform configuration to preview. Ensure this Terraform configuration complies with the [constraints](/infrastructure-manager/docs/terraform#constraints), including that the configuration does not contain sensitive data.\n5. If you want to store the Terraform configuration in a storage bucket, ensure\n the Terraform configuration is uploaded to a Cloud Storage bucket. See\n [Upload a configuration to a storage bucket](/infrastructure-manager/docs/upload-terraform-configuration)\n for more details.\n\n A storage bucket lets you control access to the configuration. You\n can also deploy a Terraform configuration that is stored in a\n public Git repository, or stored on your\n local machine.\n\nPreview the deletion of a deployment\n------------------------------------\n\nBefore you delete a deployment, you can preview and review the deletion.\n\nTo preview the deletion of a deployment: \n\n gcloud infra-manager previews create --preview-mode DELETE --deployment=projects/\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e/locations/\u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e/previews/\u003cvar translate=\"no\"\u003eDEPLOYMENT_ID\u003c/var\u003e \\\n --service-account projects/\u003cvar translate=\"no\"\u003eSERVICE_ACCOUNT_PROJECT_ID\u003c/var\u003e/serviceAccounts/\u003cvar translate=\"no\"\u003eSERVICE_ACCOUNT\u003c/var\u003e \\\n\nReplace:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e is the project ID where Infrastructure Manager runs.\n- \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e is the location where Infra Manager runs. See [Infrastructure Manager locations](/infrastructure-manager/docs/locations) for the list of valid locations.\n- \u003cvar translate=\"no\"\u003ePREVIEW_ID\u003c/var\u003e is the preview identifier that you specify. See [Preview name](/infrastructure-manager/docs/deployments-revisions#preview_name) for details about constraints on the preview identifier.\n- \u003cvar translate=\"no\"\u003eSERVICE_ACCOUNT\u003c/var\u003e is the name of the service account you use to call Infra Manager.\n- \u003cvar translate=\"no\"\u003eSERVICE_ACCOUNT_PROJECT_ID\u003c/var\u003e is the project ID of the service account. It's common for this to be the same project where Infra Manager runs.\n- \u003cvar translate=\"no\"\u003eDEPLOYMENT_ID\u003c/var\u003e is the deployment identifier of the deployment you want to update.\n\nNow that you have created a preview, you can\n[export and view the results](/infrastructure-manager/docs/export-view-preview-results)\nto review the plan for the deployment.\n\nFor more information about deleting deployments, see\n[Delete a deployment](/infrastructure-manager/docs/delete-deployments).\n\nWhat's next\n-----------\n\n- [Export and view preview results](/infrastructure-manager/docs/export-view-preview-results)\n- [Delete a deployment](/infrastructure-manager/docs/delete-deployments).\n- [Create a new preview](/infrastructure-manager/docs/preview-deployment).\n- [Automate deployments](/infrastructure-manager/docs/automate-git).\n- Learn more about [Terraform with Infra Manager](/infrastructure-manager/docs/terraform)."]]