Skip to content

fix(0-bootstrap): attach org policies to enclave folder when org-level policies disabled - #422

Open
johnlakeee wants to merge 1 commit into
mainfrom
fix/0-bootstrap-folder-org-policies
Open

johnlakeee wants to merge 1 commit into
mainfrom
fix/0-bootstrap-folder-org-policies

Conversation

@johnlakeee

Copy link
Copy Markdown
Collaborator

Description

When deploy_org_resources.org_policies = false, module "root-folder-config" in fast/stages-aw/0-bootstrap/organization.tf previously omitted both org_policies and factories_config.org_policies, silently dropping all Stage 0 organization policies instead of attaching them to local.assured_workload_folder.

  • Include !var.deploy_org_resources.org_policies in local.deploy_root_folder_config
  • Pass org_policies, factories_config.org_policies, and context.condition_vars.root_node = local.assured_workload_folder to module "root-folder-config"
  • Add unit test tests/test_bootstrap_folder_org_policies.py

Part of #388 (Milestone 1 — Group A, PR 1 of 6).

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

Testing Performed

  • terraform fmt -check -recursive, terraform validate, tflint (155 directories, 0 failed)
  • ruff check & ruff format --check
  • pytest: 134 passed
  • All tests/test_*.sh shell suites passed

@github-actions github-actions Bot added Scope - Fast Related to Fabric FAST deployment stages in the fast directory Bug Something isn't working Level of Effort - Low Quick, well-defined tasks with no unknowns; takes a few hours up to one day to complete Priority - Medium Standard features and non-blocking bugs; important for the current milestone but not urgent labels Nov 16, 2026

@aghassemlouei aghassemlouei left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for putting together the folder-scoped organization policy fallback for Stage 0. Running terraform plan with deploy_org_resources.org_policies = false surfaced three issues in fast/stages-aw/0-bootstrap/organization.tf along with a pull request template gap:

  • In fast/stages-aw/0-bootstrap/organization.tf line 91, var.deploy_org_resources.org_policies ? {} : local.org_policies fails during terraform plan with Error: Inconsistent conditional result types because Terraform infers map(any) from {} whereas local.org_policies is a 68-attribute structural object whose rules[*].allow.values tuples vary in length. Passing var.deploy_org_resources.org_policies ? null : ... matches module "organization" on line 410 because modules/folder/variables.tf sets default = {} and nullable = false on variable "org_policies", and tests/test_bootstrap_folder_org_policies.py line 52 should be updated to match ? null :.
  • In fast/stages-aw/0-bootstrap/organization.tf lines 70 to 74, context = { condition_vars = { root_node = local.assured_workload_folder } } fails once local.assured_workload_folder is known with Error: Invalid value for input variable: attribute "condition_vars": element "root_node": map of string required because modules/folder/variables.tf line 193 declares condition_vars = optional(map(map(string)), {}) rather than map(any). Because data/custom-org-policies/*.yaml are already rendered via templatefile(...) in organization.tf, the context block on module "root-folder-config" can be removed.
  • When var.deploy_org_resources.org_policies = false, module "organization" sets org_policy_custom_constraints = null on lines 394 to 398 and skips creating custom.kmsRotation and custom.restrictFirewallRanges, yet local.org_policies still includes both keys from data/org-policies/cloudkms_policy.yaml and data/org-policies/networking_policy.yaml. Filtering out startswith(k, "custom.") keys on the folder fallback when !var.deploy_org_resources.org_policies prevents NOT_FOUND errors at apply time in environments where custom constraints have not been pre-created at the organization level.
  • Please also include the ## Deployment & Compliance Impact and ## Checklist sections from .github/pull_request_template.md in the pull request description.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something isn't working Level of Effort - Low Quick, well-defined tasks with no unknowns; takes a few hours up to one day to complete Priority - Medium Standard features and non-blocking bugs; important for the current milestone but not urgent Scope - Fast Related to Fabric FAST deployment stages in the fast directory

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants