이 페이지에서는 Google Cloud용 Terraform을 사용할 때 교차 구성 통신을 위한 가이드라인과 권장사항을 제공합니다.
이 가이드는 Terraform 소개 내용이 아닙니다. Google Cloud에서 Terraform 사용에 대한 소개 정보는 Terraform 시작하기를 참조하세요.
Terraform을 사용할 때 발생하는 일반적인 문제는 여러 팀에서 관리될 수 있는 여러 Terraform 구성 간에 정보를 공유하는 방법에 관한 것입니다. 일반적으로 단일 구성 디렉터리(또는 심지어 단일 저장소)에 저장하지 않더라도 여러 구성 간에 정보가 공유될 수 있습니다.
Terraform에서 관리되지 않는 리소스를 쿼리하기 위해서는 Google 제공업체의 데이터 소스를 사용합니다.
예를 들어 데이터 소스를 사용해서 기본 Compute Engine 서비스 계정을 검색할 수 있습니다.
다른 Terraform 구성으로 관리되는 리소스를 쿼리할 때는 데이터 소스를 사용하지 않습니다. 이렇게 하면 리소스 이름 및 구조에 대한 암시적 종속 항목이 생성되고, 일반적인 Terraform 작업에 따라 의도치 않게 손상될 수 있습니다.
[[["이해하기 쉬움","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(UTC)"],[[["\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)."]]