Skip to content

fix(stages): configure Stage 0 and Stage 1 state bucket CMEK, tenant IAM, and CI templates - #349

Closed
aghassemlouei wants to merge 1 commit into
mainfrom
fix/stages-0-1-iam-wif-and-org-policies
Closed

aghassemlouei wants to merge 1 commit into
mainfrom
fix/stages-0-1-iam-wif-and-org-policies

Conversation

@aghassemlouei

@aghassemlouei aghassemlouei commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Description

Configures CMEK encryption and force_destroy on the Stage 0 checklist bucket and optional Stage 1 branch state buckets, fixes Stage 0 custom constraint and custom role definitions, and resolves Stage 1 tenant IAM and CI/CD workflow template bugs:

  • Configure encryption_key = module.gcs-kms.keys.gcs.id, force_destroy = var.force_destroy, and depends_on = [module.organization, module.gcs-kms] on module.automation-tf-checklist-gcs in fast/stages-aw/0-bootstrap/checklist.tf, and configure encryption_key and force_destroy across the 11 optional Stage 1 branch state buckets in fast/stages-aw/1-resman/branch-{data-platform,gcve,gke,project-factory,sandbox,teams}.tf so every state and checklist bucket complies with constraints/gcp.restrictNonCmekServices under IL5 and FEDRAMP_HIGH.
  • Use resource.sourceRanges.exists(range, range == '0.0.0.0/0' || range == '::/0') on custom.restrictFirewallRanges in fast/stages-aw/0-bootstrap/data/custom-constraint-policies/networking.yaml so multi-CIDR ingress rules containing 0.0.0.0/0 or ::/0 cannot bypass the .all(...) check.
  • Remove write permission storage.objects.create from the read-only custom role in fast/stages-aw/0-bootstrap/data/custom-roles/storage_viewer.yaml.
  • Replace hardcoded 0-bootstrap-providers.tf and 0-bootstrap-r-providers.tf filenames with ${tf_providers_files.apply} and ${tf_providers_files.plan} in fast/stages-aw/0-bootstrap/templates/workflow-gitlab.yaml and fast/stages-aw/1-resman/templates/workflow-gitlab.yaml.
  • Fix local.tenant_iam[each.key] lookup and merge overlapping authoritative google_folder_iam_binding maps on module.tenant-top-folders[each.key].id in fast/stages-aw/1-resman/branch-tenants.tf.
  • Populate service_accounts, tf_providers_files, and audiences in local.team_cicd_workflow_attrs and local.team_cicd_workflows in fast/stages-aw/1-resman/outputs.tf and sync fast/stages-aw/1-resman/README.md.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Deployment & Compliance Impact

  • Assured Workloads / IL5
  • FedRAMP High
  • FedRAMP Moderate
  • Gemini for Government
  • Core Infrastructure / Modules

Checklist

  • My code follows the style guidelines of this project (terraform fmt, tflint, ruff).
  • I have performed a self-review of my own code.
  • I have updated the documentation (README.md via tfdoc) where applicable.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.

Testing Performed

  • Ran bash tools/lint.sh across boilerplate, terraform fmt, tflint (137 directories), tfdoc README checks, and ruff.
  • Added unit tests in tests/test_bootstrap_logging_order.py and verified all tests pass via pytest.

@aghassemlouei aghassemlouei added Bug Something isn't working Framework - FedRAMP High FedRAMP High compliance regime and controls Framework - IL5 DoD Impact Level 5 (IL5) compliance regime and controls Level of Effort - Medium Moderate task requiring thought and testing; typically takes a couple of days to a week Priority - High Critical issues blocking development or users; urgent bugs or core features for release Scope - Fast Related to Fabric FAST deployment stages in the fast directory Security Something is insecure or can be secured labels Oct 23, 2026
@aghassemlouei
aghassemlouei force-pushed the fix/stages-0-1-iam-wif-and-org-policies branch from 1acf4ce to 816160f Compare October 26, 2026 17:27
@WandLZhang

Copy link
Copy Markdown
Member

This PR deletes under:folders/832634261155 from compute.restrictVpcPeering in networking_policy.yaml, and test_stage0_and_stage1_security_hardening asserts the ID is gone.

That's the Private Services Access producer folder. Your review on #352 (#352 (review)) lists it for Cloud SQL, AlloyDB, Memorystore, Filestore, Vertex AI and Cloud Build private pools, so deleting it blocks PSA peering in every deployment. #351 and #352 started with the same deletion, and digitalresistor showed why it breaks PSA.

#352 keeps the folder as the default of org_policies_config.constraints.allowed_vpc_peering_producers and edits the same lines, so the two PRs conflict, and the new assertion fails once #352 lands. Could this PR keep the line and drop that assertion?

@aghassemlouei
aghassemlouei force-pushed the fix/stages-0-1-iam-wif-and-org-policies branch from 816160f to 65a819e Compare October 27, 2026 17:22
@aghassemlouei aghassemlouei changed the title fix(stages): harden Stage 0 and Stage 1 IAM, WIF, KMS, and org policies fix(stages): configure Stage 0 and Stage 1 state bucket CMEK, tenant IAM, and CI templates Oct 27, 2026
@aghassemlouei

Copy link
Copy Markdown
Member Author

Thank you @WandLZhang for the catch on under:folders/832634261155 and for keeping these changes honest. Opening such a high volume of pull requests at once created avoidable review noise regardless of the driver, and future contributions will be scoped into smaller, better-vetted changes. The open pull requests will also be peer reviewed by @digitalresistor as they go through the end-to-end deployment.

This branch has been updated to restore under:folders/832634261155 in fast/stages-aw/0-bootstrap/data/custom-org-policies/networking_policy.yaml so Private Services Access peering continues to work out of the box and #352 can make the producer list configurable cleanly. The diff has also been narrowed to the concrete Stage 0 and Stage 1 functional fixes, dropping the IAM condition and CI workflow churn.

…IAM, and CI templates

- Configure `encryption_key` and `force_destroy` on `module.automation-tf-checklist-gcs` in `0-bootstrap/checklist.tf` and across the 11 optional Stage 1 branch state buckets in `1-resman/branch-*.tf` so all state and checklist buckets satisfy `constraints/gcp.restrictNonCmekServices` under `IL5` and `FEDRAMP_HIGH`.
- Use `.exists(range, range == '0.0.0.0/0' || range == '::/0')` on `custom.restrictFirewallRanges` in `0-bootstrap/data/custom-constraint-policies/networking.yaml` so multi-CIDR ingress rules containing `0.0.0.0/0` or `::/0` cannot bypass the check.
- Remove `storage.objects.create` from `0-bootstrap/data/custom-roles/storage_viewer.yaml`.
- Use `${tf_providers_files.apply}` and `${tf_providers_files.plan}` in `0-bootstrap/templates/workflow-gitlab.yaml` and `1-resman/templates/workflow-gitlab.yaml`.
- Fix `local.tenant_iam[each.key]` lookup and consolidate overlapping authoritative `google_folder_iam_binding` resources on `module.tenant-top-folders[each.key].id` in `1-resman/branch-tenants.tf`.
- Populate `service_accounts`, `tf_providers_files`, and `audiences` in `local.team_cicd_workflow_attrs` and `local.team_cicd_workflows` in `1-resman/outputs.tf` and sync `1-resman/README.md`.
@aghassemlouei
aghassemlouei force-pushed the fix/stages-0-1-iam-wif-and-org-policies branch from 65a819e to 35373ac Compare October 28, 2026 04:09
@aghassemlouei

Copy link
Copy Markdown
Member Author

Rebased onto main (db8271cf), resolving the conflict in fast/stages-aw/1-resman/branch-tenants.tf and README.md by preserving the var.factories_config.org_policies wiring from #294 alongside the Stage 0 and Stage 1 CMEK and tenant folder IAM fixes.

@aghassemlouei

Copy link
Copy Markdown
Member Author

Closing this multi-directory bundle PR so Stage 0 and Stage 1 fixes can land in smaller, single-purpose pull requests against current main. The remaining Stage 0 and Stage 1 security and functional findings are tracked in #369 under #33.

@aghassemlouei
aghassemlouei deleted the fix/stages-0-1-iam-wif-and-org-policies branch October 28, 2026 04:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something isn't working Framework - FedRAMP High FedRAMP High compliance regime and controls Framework - IL5 DoD Impact Level 5 (IL5) compliance regime and controls Level of Effort - Medium Moderate task requiring thought and testing; typically takes a couple of days to a week Priority - High Critical issues blocking development or users; urgent bugs or core features for release Scope - Fast Related to Fabric FAST deployment stages in the fast directory Security Something is insecure or can be secured

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants