Verifique se você tem as permissões do IAM necessárias para criar implantações: roles/config.admin.
Verifique se a conta de serviço usada pela última vez para criar ou atualizar a
implantação ainda está válida. O Infra Manager usa essa conta de serviço
para excluir a implantação.
Para saber mais sobre como configurar a conta de serviço, incluindo a configuração
das permissões necessárias, consulte
Configurar a conta de serviço.
Verifique se a configuração do Terraform que o Infrastructure Manager usou para criar ou atualizar a implantação ainda é válida. O Infra Manager usa
essa configuração para excluir a implantação.
Identifique a implantação do Infra Manager que você quer excluir.
Verifique se a conta de serviço tem as permissões do IAM
necessárias para excluir recursos nos projetos e locais especificados.
Conceder permissões específicas para a configuração
Para excluir recursos Google Cloud em uma implantação específica, a conta de serviço usada para chamar o Infra Manager precisa de permissões específicas para o que você está excluindo.
Essas permissões são adicionais às permissões necessárias para usar o
serviço Infra Manager.
Para detalhes sobre como conceder permissões para os recursos Google Cloud e
garantir que você tenha acesso aos projetos necessários, consulte
Configurar a conta de serviço.
Excluir uma implantação
Quando uma implantação do Infra Manager é criada, ele armazena metadados sobre a implantação, a configuração do Terraform que é implantada e o arquivo de estado.
Ao excluir uma implantação, você também exclui esses metadados e arquivos. Também é possível
excluir ou manter os recursos provisionados pela implantação.
Excluir recursos provisionados
Para excluir os metadados de implantação e os recursos provisionados:
Se quiser, liste os recursos provisionados pela implantação:
DEPLOYMENT_ID: o identificador de implantação que você
especifica. Consulte Nome da implantação para saber mais sobre as restrições no identificador de implantação.
REVISION_ID: o ID da revisão que representa uma revisão
específica de uma implantação. Consulte Nome da implantação
para saber mais sobre as restrições no identificador de revisão.
DEPLOYMENT_ID: o identificador de implantação que você
especifica. Consulte Nome da implantação para saber mais sobre as restrições no identificador de implantação.
Manter recursos provisionados
Você pode excluir a implantação e manter os recursos Google Cloud provisionados por ela.
Por exemplo, você implanta uma configuração dos
blueprints e módulos do Terraform para Google Cloud. Depois de implantar, você quer gerenciar os recursos
pelo console, e não usar a infraestrutura como código (IaC). Nesse caso,
é recomendável excluir a implantação, já que você não vai usar os
metadados dela.
Para excluir os metadados de implantação e manter os recursos provisionados:
DEPLOYMENT_ID: o identificador de implantação que você
especifica. Consulte Nome da implantação para saber mais sobre as restrições no identificador de implantação.
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 2025-08-19 UTC."],[[["\u003cp\u003eThis guide details the process of deleting an Infrastructure Manager deployment, which involves removing the associated metadata and optionally, the provisioned resources.\u003c/p\u003e\n"],["\u003cp\u003eBefore deleting, ensure Infrastructure Manager is enabled, you have the necessary IAM permissions, and the service account and Terraform configuration used for the deployment are valid.\u003c/p\u003e\n"],["\u003cp\u003eYou can choose to delete the deployment along with all provisioned Google Cloud resources, or opt to retain the resources while only deleting the deployment metadata.\u003c/p\u003e\n"],["\u003cp\u003eTo delete both the deployment and provisioned resources, use the \u003ccode\u003egcloud infra-manager deployments delete\u003c/code\u003e command, and for keeping the resources, use the same command with the \u003ccode\u003e--delete-policy=abandon\u003c/code\u003e flag.\u003c/p\u003e\n"],["\u003cp\u003eThe service account used for the operation needs permissions for the Infrastructure Manager service and to delete resources within the specified Google Cloud project and location, as well as a valid Terraform configuration.\u003c/p\u003e\n"]]],[],null,["# Delete a deployment\n\nThis page describes how to delete an Infrastructure Manager deployment.\n\nThis page assumes you are familiar with Terraform. For details, see\n[Terraform and Infrastructure Manager](/infrastructure-manager/docs/terraform).\n\nBefore you begin\n----------------\n\n1. Ensure [Infra Manager is enabled](/infrastructure-manager/docs/enable-service).\n2. Ensure that you have the IAM permissions needed to create deployments: `roles/config.admin`.\n3. Ensure the service account that was last used to create or update the deployment is still valid. Infra Manager uses this service account to delete the deployment.\n - For details about configuring the service account, including setting up required permissions, see [Configure the service account](/infrastructure-manager/docs/configure-service-account).\n - To determine the service account that was last used for the deployment, see [View the state of a revision](/infrastructure-manager/docs/view-deployments#revision-details).\n4. Ensure the Terraform configuration that Infra Manager used to create or update the deployment is still valid. Infra Manager uses this configuration to delete the deployment.\n5. Identify the Infra Manager deployment to delete.\n6. Ensure that the service account has the IAM permissions needed to delete resources in the specified projects and locations.\n\nGrant permissions specific to the configuration\n-----------------------------------------------\n\nTo delete Google Cloud resources in a specific deployment, the service\naccount that you use to call Infra Manager needs\npermissions that are specific to what you are deleting.\n\nThese permissions are in addition to the permissions needed to use the\nInfra Manager service.\n\nFor details about granting permissions for the Google Cloud resources and\nensuring you have access to the needed projects, see\n[Configure the service account](/infrastructure-manager/docs/configure-service-account).\n\nDelete a deployment\n-------------------\n\nWhen an Infra Manager deployment is created, Infra Manager\nstores metadata about the deployment, the Terraform configuration that is\ndeployed, and the state file.\n\nWhen you delete a deployment, you delete this metadata and files. You can\nalso delete the resources provisioned by the deployment, or keep these\nresources.\n\n### Delete provisioned resources\n\n| **Caution:** Deleting Google Cloud resources can cause unrecoverable data loss. Re-deploying the configuration will not restore data.\n\nTo delete the deployment metadata and delete the provisioned resources:\n\n1. Optionally, list the resources provisioned by the deployment:\n\n gcloud infra-manager resources list projects/\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e/locations/\u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e/deployments/\u003cvar translate=\"no\"\u003eDEPLOYMENT_ID\u003c/var\u003e/revisions/\u003cvar translate=\"no\"\u003eREVISION_ID\u003c/var\u003e\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the project ID where Infrastructure Manager runs.\n - \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e: the location where Infra Manager runs. See [Infrastructure Manager locations](/infrastructure-manager/docs/locations) for the list of valid locations.\n - \u003cvar translate=\"no\"\u003eDEPLOYMENT_ID\u003c/var\u003e: the deployment identifier that you specify. See [Deployment name](/infrastructure-manager/docs/overview#deployments) for details about constraints on the deployment identifier.\n - \u003cvar translate=\"no\"\u003eREVISION_ID\u003c/var\u003e: the revision ID representing a specific revision of a deployment. See [Deployment name](/infrastructure-manager/docs/overview#deployments) for details about constraints on the revision identifier.\n2. Preview the deletion of the resources. For details, see\n [Preview a deletion of a deployment](/infrastructure-manager/docs/preview-deployment-deletion).\n\n3. Delete the deployment and provisioned resources:\n\n gcloud infra-manager deployments delete projects/\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e/locations/\u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e/deployments/\u003cvar translate=\"no\"\u003eDEPLOYMENT_ID\u003c/var\u003e\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the project ID where Infrastructure Manager runs.\n - \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e: the location where Infra Manager runs. See [Infrastructure Manager locations](/infrastructure-manager/docs/locations) for the list of valid locations.\n - \u003cvar translate=\"no\"\u003eDEPLOYMENT_ID\u003c/var\u003e: the deployment identifier that you specify. See [Deployment name](/infrastructure-manager/docs/overview#deployments) for details about constraints on the deployment identifier.\n\n### Keep provisioned resources\n\nYou may want to delete the deployment and keep the Google Cloud resources\nthat were provisioned by the deployment.\n\nFor example, you deploy a configuration from the\n[Terraform blueprints and modules for Google Cloud](/docs/terraform/blueprints/terraform-blueprints). Once it's deployed, you want to manage the resources\nthrough the console, and not use Infrastructure as Code (IaC). In this case,\nyou may want to delete the deployment as you don't have use for the\ndeployment's metadata.\n| **Note:** After you delete the deployment, Infra Manager is not able to identify or manage the Google Cloud resources that are kept.\n\nTo delete the deployment metadata and keep the provisioned resources: \n\n gcloud infra-manager deployments delete projects/\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e/locations/\u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e/deployments/\u003cvar translate=\"no\"\u003eDEPLOYMENT_ID\u003c/var\u003e \\\n --delete-policy=abandon\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the project ID where Infrastructure Manager runs.\n- \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e: the location where Infra Manager runs. See [Infrastructure Manager locations](/infrastructure-manager/docs/locations) for the list of valid locations.\n- \u003cvar translate=\"no\"\u003eDEPLOYMENT_ID\u003c/var\u003e: the deployment identifier that you specify. See [Deployment name](/infrastructure-manager/docs/overview#deployments) for details about constraints on the deployment identifier.\n\nWhat's next\n-----------\n\n- Learn more about [Terraform with Google Cloud](/docs/terraform).\n- [View the state of a deployment](/infrastructure-manager/docs/view-deployments).\n- [View resources deployed](/infrastructure-manager/docs/view-resources)."]]