[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-09-03。"],[[["\u003cp\u003eDM Convert is a tool that converts Deployment Manager configurations and templates to Terraform or Kubernetes Resource Model (KRM) formats.\u003c/p\u003e\n"],["\u003cp\u003eConverting to Terraform or KRM offers actively-updated ecosystems with support for modern features, including integration with Google services and infrastructure.\u003c/p\u003e\n"],["\u003cp\u003eDM Convert translates Deployment Manager concepts like references, dependencies, and IAM Bindings into corresponding KRM or Terraform structures, but it doesn't support actions or custom type providers without declarative equivalents.\u003c/p\u003e\n"],["\u003cp\u003eTo convert to Terraform, users must identify the configuration, reconcile active deployments, run DM Convert, verify the generated output, and delete the Deployment Manager deployment.\u003c/p\u003e\n"],["\u003cp\u003eThe DM Convert tool collects anonymous usage data by default to improve its functionality, but users can opt out by using the \u003ccode\u003e--opt_out_data_collection=true\u003c/code\u003e flag.\u003c/p\u003e\n"]]],[],null,["# Using DM Convert to transition to Terraform or Kubernetes Resource Model (KRM)\n\n| **Preview**\n|\n|\n| This product or feature is subject to the \"Pre-GA Offerings Terms\" in the General Service Terms section\n| of the [Service Specific Terms](/terms/service-terms#1).\n|\n| Pre-GA products and features are available \"as is\" and might have limited support.\n|\n| For more information, see the\n| [launch stage descriptions](/products#product-launch-stages).\n\nDeployment Manager Convert (DM Convert) is a tool you can use to convert\nyour Deployment Manager\n[configurations](/deployment-manager/docs/configuration) and\n[templates](/deployment-manager/docs/configuration/templates/create-basic-template)\nto other declarative configuration formats that Google supports. Google\ncurrently supports [Terraform](/docs/terraform) and [Kubernetes Resource Model (KRM)](https://github.com/kubernetes/design-proposals-archive/blob/main/architecture/resource-management.md).\n\nWhy convert to Terraform or KRM?\n--------------------------------\n\nTerraform and KRM are popular options for managing Google Cloud services\nand infrastructure. They offer actively-updated ecosystems, with support for\nmodern features such as Secrets management and continuous reconciliation (for\nKRM).\n\nGoogle works with [HashiCorp](https://www.hashicorp.com/) to\ndevelop the [Terraform provider for Google Cloud](https://registry.terraform.io/providers/hashicorp/google/latest/docs).\nIn 2020, Google also launched [Config Connector](/config-connector/docs/overview) to help\ncustomers use Kubernetes to manage Google Cloud [resource types](/config-connector/docs/reference/overview).\n\n### Terraform\n\n[Terraform](https://www.terraform.io/) is an open-source tool for\nprovisioning infrastructure. You can use Terraform to write declarative\nconfigurations to manage your Google Cloud services and resources using\nthe [Terraform provider for Google Cloud](https://registry.terraform.io/providers/hashicorp/google/latest/docs).\nFor more information, refer to [Terraform on Google Cloud](/docs/terraform).\n\n### Kubernetes Resource Model (KRM)\n\n[KRM](https://github.com/kubernetes/design-proposals-archive/blob/main/architecture/resource-management.md)\nis a paradigm for building APIs and resource definitions for declarative\nconfiguration management. It represents Google Cloud resources as\n[Custom Resource Definitions (CRDs)](/config-connector/docs/reference/overview)\nand can be actuated using [Config Controller](/anthos-config-management/docs/concepts/config-controller-overview).\n\nSupported types and type providers\n----------------------------------\n\nDM Convert converts Deployment Manager configuration YAML files and Jinja or\nPython template files to KRM or Terraform configuration files.\n\nTo check the current status of DM Convert's support for type providers and\nresource types, you can use the `--list-supported-types` flag.\n\nUnderstanding how DM Convert translates concepts across formats\n---------------------------------------------------------------\n\nThe following table shows how DM Convert translates concepts from\nDeployment Manager into KRM and Terraform:\n\nSupport for Actions in DM Convert (for Terraform)\n-------------------------------------------------\n\nActions is a Preview feature for Deployment Manager that extends the set of\navailable API methods.\n[Actions is unsupported](/deployment-manager/docs/migrations/actions), and DM\nConvert doesn't convert Actions that don't have declarative equivalents in\nTerraform, such as:\n\n- Patch, delete, and list APIs\n\n- APIs defined in custom type providers\n\n- Custom APIs, such as `sqladmin-v1beta4:sql.instances.restart`\n\nDM Convert does support conversion to Terraform equivalents for Actions in the\nfollowing cases:\n\n- It replaces Action calls to APIs that insert a resource with equivalent\n Terraform resources. For example,\n `action: gcp-types/storage-v1:storage.buckets.insert` converts to\n [`google_storage_bucket`](http://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/storage_bucket).\n\n- It converts Action calls to APIs that get a resource to Terraform `data` types\n whenever possible. For example,\n `actions: gcp-types/compute-v1:compute.subnetworks.get` converts to\n [`google_compute_subnetwork`](https://registry.terraform.io/providers/hashicorp/google/latest/docs/data-sources/compute_subnetwork).\n\n- It converts `setIamPolicy` commands to either `*_iam_policy` (authoritative)\n or `*_iam_member` (non-authoritative) resources, depending on whether or not\n they're used with `getIamPolicy`.\n\nFor information on migrating usage of Actions to declarative alternatives within\nDeployment Manager, visit\n[Replacing usage of Actions](/deployment-manager/docs/migrations/actions).\n\nWorkflow for converting to Terraform\n------------------------------------\n\nTo use DM Convert to convert your Deployment Manager configurations to Terraform:\n\n1. Identify the Deployment Manager configuration you want to convert to Terraform.\n2. To make sure your resources are up-to-date, reconcile any active deployments of the configuration.\n3. To convert your configuration to Terraform, [run the DM Convert tool](/deployment-manager/docs/dm-convert/convert) locally.\n4. Verify that the generated Terraform configuration reflects the current state of your resources.\n5. Delete the Deployment Manager deployment. To preserve your resources when you delete the deployment, set `delete-policy` to `abandon`.\n\nWe recommend that you follow [Terraform best practices](/docs/terraform/best-practices-for-terraform#root-modules), such as:\n\n- Storing your [Terraform state in a Cloud Storage bucket](/docs/terraform/resource-management/store-state)\n- [Using Cloud Build to manage actuation](/architecture/managing-infrastructure-as-code).\n\nFor a detailed walkthrough of this workflow, refer to [Converting your Deployment Manager configurations with DM Convert](/deployment-manager/docs/dm-convert/convert).\n\nData collection in DM Convert\n-----------------------------\n\n### What we collect, by default\n\nBy default, the DM Convert tool sends anonymous usage data to Google to help us\nmaintain and improve the tool. When the DM Convert tool executes, data about the\nrequested operation, the success of the operation, and the timing of the\nconversion is collected. This data is anonymous, and excludes any personally\nidentifiable information, sensitive data, or customer content.\n\nThe usage data might contain:\n\n- **Conversion command input parameters:** We record the parameter values of\n your conversion command when running the tool, including the output format\n (KRM or Terraform) and boolean representations of whether other flags are\n specified (we don't collect the specific values of those flags).\n\n- **Conversion result:** We record the results of the conversion, including the\n conversion status (`SUCCESS` or `FAILURE`) as well as the error code and error\n message, if an issue occurs.\n\n- **Conversion time:** We record the start and end times of the conversion.\n\n### How we use this data\n\nGoogle collects and processes the usage data to:\n\n- Understand how the tool is used, including which features and settings are\n most popular.\n\n- Diagnose unsuccessful usage of the tool, and provide guidance to users seeking\n technical assistance.\n\n- Improve the tool by resolving issues and potentially increasing feature\n coverage.\n\n### Opting out of data collection\n\nGoogle collects usage data by default when you execute a conversion, but this\ndata collection can be disabled.\n\nTo disable the data collection for a specific conversion, you can specify the\nflag `--opt_out_data_collection=true` in your conversion command. To\ncontinue to opt out of this data collection going forward, you must specify the\nflag every time that you run a conversion.\n\nTo enable the data collection for a specific conversion, you can specify the\nflag `--opt_out_data_collection=false` in your conversion command, or omit the\nflag from your command."]]