Repository navigation
fix(stages-aw)!: fix firewall constraint, viewer role, bucket CMEK, tenant IAM, and CI/CD templates - #419
Merged
Conversation
…enant IAM, and CI/CD templates Fixes #369 BREAKING CHANGE: fast/stages-aw/1-resman consolidates module.tenant-core-folders-iam and module.tenant-self-folders-iam into module.tenant-top-folders-iam. Existing deployments with var.tenants populated should run: terraform state rm 'module.tenant-core-folders-iam' 'module.tenant-self-folders-iam' before applying Stage 1, and re-apply Stage 0 (0-bootstrap) first so 0-bootstrap.auto.tfvars.json exports automation.kms_keys.gcs.
Calvin-Cheng1
marked this pull request as draft
November 13, 2026 15:58
aghassemlouei
left a comment
Member
There was a problem hiding this comment.
Overall these fixes look solid, especially the .exists(...) firewall constraint update, removing storage.objects.create from storage_viewer, and keying tenant_iam by k alongside the deep-merged tenant-top-folders-iam policy map. A few items to look at before marking this ready for review:
fast/assets/templates/workflow-sourcerepo.yamlmismatch: Since this PR updatesfast/assets/templates/workflow-gitlab.yamlalongside the0-bootstrapand1-resmantemplates, line 96 offast/assets/templates/workflow-sourcerepo.yamlstill references${tf_providers_file.apply}(singular) instead of${tf_providers_files.apply}, which failstemplatefile()when giventf_providers_files.- Pre-upgrade CMEK behavior on
var.automation.kms_keys.gcs: Becausekms_keysdefaults to{}(gcs = null), applying Stage 1 with a pre-upgrade0-bootstrap.auto.tfvars.jsonstripsencryptionfrombranch-network-gcsandbranch-security-gcs, leaves the newly wired branch buckets unencrypted, and destroysresman_bootstrap_kmsbindings. Consider either falling back viacoalesce(var.automation.kms_keys.gcs, "projects/${var.automation.project_id}/locations/${var.regions.primary}/keyRings/gcs/cryptoKeys/gcs")or enforcingvar.automation.kms_keys.gcs != nullin avalidationblock so Stage 1 fails fast instead of silently clearing CMEK. - Minor cleanup in
branch-networking.tfandbranch-security.tf: Both buckets still retaindepends_on = [google_kms_crypto_key_iam_member.resman_bootstrap_kms], whereas Stage 0 already grants the automation project GCS service agent access in0-bootstrap/kms.tfandresman_bootstrap_kmsis only populated for tenant projects. - Test coverage in
tests/test_bootstrap_resman_fixes.py: Most checks use substring matching on.tf/.yamlfiles. Adding atemplatefile()render +yaml.safe_load()check across allworkflow-*.yamltemplates (matchingtests/test_workflow_templates.py) would catch template variable drift automatically.
12 of 19 tasks
Calvin-Cheng1
marked this pull request as ready for review
November 16, 2026 21:01
aghassemlouei
approved these changes
Nov 16, 2026
aghassemlouei
left a comment
Member
There was a problem hiding this comment.
Thanks for addressing all the review items, including the workflow-sourcerepo.yaml fix, local.gcs_kms_key fallback, declarative removed blocks in branch-tenants.tf, and full workflow template rendering tests.
Open
This was referenced Nov 17, 2026
1 task done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Resolves five security and functional defects across
fast/stages-aw/0-bootstrapandfast/stages-aw/1-resman:0-bootstrap): Replaces.all(...)withresource.sourceRanges.exists(range, range == '0.0.0.0/0' || range == '::/0')incustom.restrictFirewallRanges(data/custom-constraint-policies/networking.yaml) so multi-CIDR rules containing0.0.0.0/0and IPv6 world-open::/0rules are denied.storage_viewercustom role (0-bootstrap): Removesstorage.objects.createfromdata/custom-roles/storage_viewer.yaml.force_destroy(0-bootstrap,1-resman): Exportsautomation.kms_keys.gcs(module.gcs-kms.keys.gcs.id) from Stage 0, adds backwards-compatiblekms_keys = optional(object({ gcs = optional(string) }), {})on Stage 1var.automation, configuresencryption_keyandforce_destroy = var.force_destroyonautomation-tf-checklist-gcs(withdepends_on = [module.organization, module.gcs-kms]) and all Stage 1 branch state buckets (data-platform,gcve,gke,project-factory,sandbox,teams), and replaces hardcoded KMS key strings inkms.tf,branch-networking.tf, andbranch-security.tf.1-resman): Indexeslocal.tenant_iam[k]instead oflocal.tenant_iam[each.value.tenant.name]inbranch-tenants.tfand consolidatesmodule.tenant-core-folders-iamandmodule.tenant-self-folders-iamintomodule.tenant-top-folders-iamwith deep-merged role bindings so authoritativegoogle_folder_iam_bindingresources no longer overwrite one another.0-bootstrap,1-resman,fast/assets): Replaces hardcoded0-bootstrap-providers.tf/0-bootstrap-r-providers.tfwith${tf_providers_files.apply}and${tf_providers_files.plan}inworkflow-gitlab.yaml, and updateslocal.team_cicd_workflows,local.team_cicd_workflow_attrs, andoutput "team_cicd_repositories"in1-resman/outputs.tfto passaudiences,service_accounts = { apply, plan }, andtf_providers_files = { apply, plan }.Fixes #369
Breaking Changes
Type of Change
Deployment & Compliance Impact
Checklist
Code Quality & Reusability
modules/orfast/stages-aw/can be leveraged for this change.docs/naming-convention.md.Documentation
README.mdof the modified module or blueprint.Security
Testing
Testing Performed
tests/test_bootstrap_resman_fixes.pycovering all 5 defects (pytest:136 passed).clitest suite (test_terraform_accepts_variablesacross all 6 regime fixtures,test_repo.py,test_render_sync.py) after updatingcli/tests/fixtures/stage-outputs/0-bootstrap.auto.tfvars.json.terraform validateand offlineterraform plan -refresh=falseon both0-bootstrapand1-resmanacross multi-env/multi-tenant configurations, pre-upgrade0-bootstrap.auto.tfvars.jsonbackwards-compatibility inputs, andgitlab/github/sourcerepobranch + team CI/CD workflows (validating all rendered workflow outputs withyaml.safe_load).check_boilerplate.py,terraform fmt -recursive -check,check_documentation.py,check_links.py,check_names.py,validate_metadata.py,ruff,pyright, and shell test suites).