[[["易于理解","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):2024-12-22。"],[[["\u003cp\u003eThis page offers guidelines for cross-configuration communication in Terraform when working with Google Cloud.\u003c/p\u003e\n"],["\u003cp\u003eRemote state, using Cloud Storage or Terraform Enterprise, is recommended for sharing information between different Terraform configurations.\u003c/p\u003e\n"],["\u003cp\u003eUtilize data sources from the Google provider to query resources not managed by Terraform.\u003c/p\u003e\n"],["\u003cp\u003eAvoid using data sources to query resources managed by other Terraform configurations to prevent unintentional breaking changes.\u003c/p\u003e\n"]]],[],null,["# Best practices for cross-configuration communication\n\nThis page provides guidelines and recommendations for\ncross-configuration communication when using Terraform for Google Cloud.\n\nThis guide is not an introduction to Terraform. For an introduction to using\nTerraform with Google Cloud, see\n[Get started with Terraform](/docs/terraform/get-started-with-terraform).\n\nA common problem that arises when using Terraform is how to share information\nacross different Terraform configurations (possibly maintained by different\nteams). Generally, information can be shared between configurations without\nrequiring that they be stored in a single configuration directory (or even a\nsingle repository).\n\nThe recommended way to share information between different Terraform\nconfigurations is by using remote state to reference other root modules.\n[Cloud Storage](https://www.terraform.io/docs/backends/types/gcs.html)\nor\n[Terraform Enterprise](https://www.terraform.io/docs/backends/types/terraform-enterprise.html)\nare the preferred state backends.\n\nFor querying resources that are not managed by Terraform, use data sources from\nthe\n[Google provider](https://registry.terraform.io/providers/hashicorp/google/latest/docs).\nFor example, the default Compute Engine service account can be retrieved\n[using a data source](https://registry.terraform.io/providers/hashicorp/google/latest/docs/data-sources/compute_default_service_account).\nDon't use data sources to query resources that are managed by another Terraform\nconfiguration. Doing so can create implicit dependencies on resource names and\nstructures that normal Terraform operations might unintentionally break.\n\nWhat's next\n-----------\n\n- Learn about [best practices for version control](/docs/terraform/best-practices/version-control).\n- Learn about [best practices when working with Google Cloud resources](/docs/terraform/best-practices/working-with-resources)."]]