跨設定通訊的最佳做法
本頁面提供使用 Terraform 為 Trusted Cloud進行跨設定通訊時的規範和建議。
本指南並非 Terraform 的介紹。如要瞭解如何搭配使用 Terraform 和 Trusted Cloud by S3NS,請參閱「開始使用 Terraform」。
使用 Terraform 時常見的問題,就是如何在不同 Terraform 設定 (可能由不同團隊維護) 之間共用資訊。一般來說,您可以在設定之間共用資訊,而不需要將資訊儲存在單一設定目錄 (甚至是單一存放區) 中。
在不同 Terraform 設定間共用資訊的建議做法,是使用遠端狀態參照其他根模組。建議的狀態後端為 Cloud Storage 或 Terraform Enterprise。
如要查詢非由 Terraform 管理的資源,請使用 Google 供應器的資料來源。舉例來說,您可以使用資料來源擷取預設的 Compute Engine 服務帳戶。請勿使用資料來源查詢由其他 Terraform 設定管理的資源。這麼做可能會在資源名稱和結構上建立隱含的依附性,而一般 Terraform 作業可能會意外中斷這些依附性。
後續步驟
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-18 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-08-18 (世界標準時間)。"],[[["This page offers guidelines for cross-configuration communication in Terraform when working with Google Cloud."],["Remote state, using Cloud Storage or Terraform Enterprise, is recommended for sharing information between different Terraform configurations."],["Utilize data sources from the Google provider to query resources not managed by Terraform."],["Avoid using data sources to query resources managed by other Terraform configurations to prevent unintentional breaking changes."]]],[]]