[Bug] 0-bootstrap: essentialcontacts.managed.allowedContactDomains parameters are double-encoded (organization.tf jsonencode()s the JSON string from platform_policy.yaml) — the post-migration apply fails
メンテナーはふだん 3 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 88/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- google-cloud, terraform
- 領域
- cloud, infrastructure
調査の方向性
fast/stages-aw/0-bootstrap/organization.tf:139 と fast/stages-aw/0-bootstrap/data/custom-org-policies/platform_policy.yaml:101 のパラメータ値から始め、Stage の custom-org-policies パスを modules/organization-se/organization-policies.tf:72-74 と比較します。docs/ddg.md にある 2 回目の Stage 0 の apply で再現し、terraform plan に二重エンコードが表示されなくなり、essentialcontacts.managed.allowedContactDomains の apply が成功することを確認します。
索引モデルが issue の本文から書いたものです。
説明
Bug Description
Since PR #210 (7a326393, first shipped in v4.0.0) the managed constraint's parameters in fast/stages-aw/0-bootstrap/data/custom-org-policies/platform_policy.yaml:101 are written as a JSON string:
essentialcontacts.managed.allowedContactDomains:
rules:
- enforce: true
parameters: '{"allowedDomains":["@${domain_name}"]}'
The stage renders that file with templatefile and formalizes each rule in 0-bootstrap/organization.tf:139:
parameters = try(jsonencode(r.parameters), null)
jsonencode of a value that is already a JSON string produces a JSON string literal — "{\"allowedDomains\":[\"@example.com\"]}" — not the object. The provider's google_org_policy_policy validates spec.rules.parameters as JSON (a string literal is valid JSON), so terraform plan accepts it, and the apply fails when the provider unmarshals the value into a map:
Error: json: cannot unmarshal string into Go value of type map[string]interface {}
with module.organization.google_org_policy_policy.default["essentialcontacts.managed.allowedContactDomains"],
on ../../../modules/organization-se/organization-policies.tf line 105, in resource "google_org_policy_policy" "default":
Because organization.tf:325 applies org policies only once bootstrap_user is unset (org_policies = var.bootstrap_user != null ? null : local.org_policies), the failure lands on the second Stage 0 apply — the one docs/ddg.md runs after the state migration and import.sh — on every deployment that follows the guide. Where the policy already exists (an organization redeployed under a new prefix), terraform plan shows it "updated in-place" from the object to the string literal, which is the clearest way to see the double encoding:
~ parameters = jsonencode(
{
- allowedDomains = [
- "@example.com",
]
}
) -> "\"{\\\"allowedDomains\\\":[\\\"@example.com\\\"]}\""
The module's own factory path (modules/organization-se/organization-policies.tf:72-74) passes templatestring(r.parameters, …) through untouched; only the stage's custom-org-policies path applies jsonencode. The essential-contacts policy is the only entry in the tree with a parameters key, so nothing else is affected.
Environment and Deployment Context
- Stellar Engine Version/Commit:
v4.0.0(6d7d08c0); the same two lines onmain(20830097, 2026-09-18). Introduced by PR #210 (2026-08-31). Providerhashicorp/googlev6.50.0. - Deployment Type:
- US Region Restricted (e.g., Access Policy constraint)
- FedRAMP Moderate
- FedRAMP High
- DoD IL4
- DoD IL5
- Stand-alone / Custom
- FAST Stage (if applicable):
- Stage 0 (Bootstrap)
- Stage 1 (Resource Management)
- Stage 2 (Networking)
- Stage 3 (Security)
Steps to Reproduce
- Follow
docs/ddg.mdthrough Stage 0: the firstterraform apply -var bootstrap_user=…, the state migration,./import.sh. terraform apply(the "one more time" apply of the guide).- Observe the error above on
google_org_policy_policy.default["essentialcontacts.managed.allowedContactDomains"]. In an organization where the policy already exists,terraform planfirst shows the in-place update from the object to the string literal.
Expected Behavior
The second Stage 0 apply completes, and the policy is set with parameters = {"allowedDomains": ["@<domain>"]} — the outcome PR #210 intended for #108.
Actual Behavior
The apply fails; the policy is not set (fresh organization) or is left as it was (redeployment). The rest of the stage's org policies apply.
Relevant Logs and Errors
See above.
Additional Context
- Fix, either form (one line):
organization.tf:139→parameters = try(r.parameters, null); or keep thejsonencodeand write the YAML value as a map,parameters: {allowedDomains: ["@${domain_name}"]}, which is presumably what thejsonencodewas written for. The first form was verified on a live deployment:terraform planthen reports no change to the policy. - Related: #108 / PR #210 (the parameters were added to fix contacts being blocked org-wide); this report is about how they are encoded, not whether they are present.
- 主要言語
- HCL
- スター
- 55
- フォーク
- 21
- 平均マージ
- 1日 22時間
- マージ済み PR(30日)
- 24
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
google/stellar-engine のほかの issue
-
[Feature Request] No research blueprint family — the README names universities as a target audience, every blueprint is FedRAMP High, FedRAMP Moderate or IL5再び着手できるかも @Calvin-Cheng1 が 31 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンEnhancement Level of Effort - High Priority - Low Scope - Blueprint
google/stellar-engine#239 · コメント 2 件 · 担当者 1 名 ·
メンテナーはふだん 3 日以内に返信
-
[Feature Request] Remove Source Repo references and modules and replace with SSM対応中かも @Calvin-Cheng1 が 12 日前に担当しました。 オープンEnhancement Level of Effort - High Priority - High Scope - Blueprint Scope - Fast Scope - Module
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
google/stellar-engine#198 · コメント 2 件 · 担当者 1 名 ·
メンテナーはふだん 3 日以内に返信
-
[Feature Request]Customize Org Policy Enforcement Based on Regime Setting対応中かも @aghassemlouei が 9 日前に担当しました。 オープンcompliance Enhancement Framework - FedRAMP High Framework - IL5 Level of Effort - Low Priority - Medium Scope - Fast Scope - Stage 0
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
google/stellar-engine#197 ·
メンテナーはふだん 3 日以内に返信
-
compliance Enhancement Framework - FedRAMP Moderate Level of Effort - High Priority - Medium Scope - Blueprint
難易度 5/5 1週間以上 初心者へのやさしさ 38/100
google/stellar-engine#192 ·
メンテナーはふだん 3 日以内に返信
-
compliance Enhancement Level of Effort - Medium Priority - Medium Scope - Blueprint Security
難易度 5/5 1週間以上 初心者へのやさしさ 38/100
google/stellar-engine#188 ·
メンテナーはふだん 3 日以内に返信
google/stellar-engine の issue をすべて見る
似ている issue
-
cloudflare: root entry eagerly imports `wrangler`, so `d1`/`r2`/`kvCache` cannot load without a Wrangler install対応中かも @emdashbot が今日担当しました。 オープンarea/cloudflare bot:bug bot:needs-attention
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
emdash-cms/emdash#4232 · コメント 4 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
auto-shift/autoshiftv2#282 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
oblien/openship#1310 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
voidzero-dev/void#463 ·
メンテナーはふだん 1 日以内に返信