[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-09-04 (世界標準時間)。"],[[["\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)."]]