Skip to content

feat(1-resman): support project organization policy overrides - #294

Merged
Calvin-Cheng1 merged 1 commit into
mainfrom
feat/resman-org-policy-exceptions
Oct 28, 2026
Merged

Calvin-Cheng1 merged 1 commit into
mainfrom
feat/resman-org-policy-exceptions

Conversation

@aghassemlouei

@aghassemlouei aghassemlouei commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

Description

  • Add org_policies = optional(string, "data/org-policies") to var.factories_config in fast/stages-aw/1-resman/variables.tf to support project-scoped organization policy YAML factories, fixing [Feature Request] Allow Organization policy exceptions at folder/project level #14.
  • Pass environment-scoped factories_config.org_policies paths (${var.factories_config.org_policies}/${lower("${each.key}-iac-core-0")} and ${var.factories_config.org_policies}/${lower("${each.key}-main-0")}) to module.tenant-self-iac-projects and module.tenant-self-main-projects in fast/stages-aw/1-resman/branch-tenants.tf.
  • Clean up the duplicate header and # tfdoc:file:description annotation in fast/stages-aw/1-resman/branch-tenants.tf and regenerate fast/stages-aw/1-resman/README.md.

Fixes #14

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

  • Applicable Regimes:
    • US Region Restricted (e.g., Access Policy constraint)
    • FedRAMP Moderate
    • FedRAMP High
    • DoD IL4
    • DoD IL5
    • General / All
  • NIST 800-53r5 Controls: SC-7, SC-12, SC-13, SC-28, AC-2, AC-3, AC-6, CM-2, CM-6

Checklist

Code Quality & Reusability

  • My code adheres to the Maximize Reusability principle. I have not redefined common elements and have reused existing base configurations and modules where possible.
  • I have checked that no existing module or configuration in modules/ or fast/stages-aw/ can be leveraged for this change.
  • My code follows the established naming conventions outlined in docs/naming-convention.md.

Documentation

  • I have updated the README.md of the modified module or blueprint.
  • I have added/updated documentation for inputs (variables) and outputs.

Security

  • My change adheres to GCP security best practices and the principle of least privilege.
  • I have ensured compliance with the targeted regime (FedRAMP Moderate, FedRAMP High, IL4, IL5, etc.).

Testing

  • I have tested my changes locally.
  • I have included details of my testing in this PR.

Testing Performed

  • Executed bash tools/run_tests.sh (all Python unit tests, shell syntax checks, shell unit tests, and CodeQL AST checks pass), terraform validate, python3 tools/check_boilerplate.py fast/stages-aw/1-resman, and python3 tools/check_documentation.py fast/stages-aw/1-resman.

@aghassemlouei aghassemlouei added Enhancement New feature or request Priority - Medium Standard features and non-blocking bugs; important for the current milestone but not urgent Status - Ready for Review labels Oct 20, 2026
@github-actions github-actions Bot added the Scope - Fast Related to Fabric FAST deployment stages in the fast directory label Oct 20, 2026
@aghassemlouei
aghassemlouei force-pushed the feat/resman-org-policy-exceptions branch 2 times, most recently from ff1dcf6 to d1119cd Compare October 20, 2026 22:33
@aghassemlouei aghassemlouei added Level of Effort - Medium Moderate task requiring thought and testing; typically takes a couple of days to a week compliance and removed Fast labels Oct 20, 2026
@aghassemlouei
aghassemlouei force-pushed the feat/resman-org-policy-exceptions branch 10 times, most recently from 7b33fca to b70f24e Compare October 23, 2026 12:46

@Calvin-Cheng1 Calvin-Cheng1 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggestions here:

I recommend simplifying the implementation so that organization policy exceptions are scoped strictly to the project level and loaded via var.factories_config.org_policies (matching 0-bootstrap).

Why This Change Is Needed

  1. Security & Compliance:
    In Assured Workloads landing zones (FedRAMP Moderate/High, DoD IL4/IL5), baseline organization policies are enforced at the Organization / Assured Workloads folder level in 0-bootstrap. Any policy exception (POA&M / risk acceptance) should be scoped down to the specific project (tenant-self-iac-projects or tenant-self-main-projects) that requires it.

    • Applying exceptions at the environment folder (module.branch-envs-folders) weakens the control for every tenant and project in that environment.
    • Applying exceptions at the tenant folder (module.tenant-top-folders) weakens the control for both the privileged automation project (<env>-<tenant>-iac-core-0) and the workload project (<env>-<tenant>-main-0), as well as any future projects created under that folder.
  2. optional(map(any), {}) Breaks Terraform Type Unification:
    Using optional(map(any), {}) inside var.envs_folders and var.tenants (map(object({...}))) causes terraform plan to fail in common real-world scenarios:

    • Mixed policy types in a single map: Configuring both a boolean policy (enforce = false) and a list policy (allow = { all = true }) in the same map fails with:
      Error: Invalid value for input variable
      ... attribute "iac_project_org_policies": all map elements must have the same type.
      
    • Different policies across environments/tenants: Configuring a boolean policy on one entry and a list policy (or a policy with a different rule structure) on another fails with:
      Error: Invalid value for input variable
      ... cannot find a common base type for all elements.
      
    • Overriding one entry while leaving another at default {}: Overriding even a single policy on one environment/tenant while leaving another at the default {} fails with:
      Error: Invalid value for input variable
      ... attribute types must all match for conversion to map.
      
  3. Environment Scoping on Tenant Projects:
    In branch-tenants.tf, local.tenant_envs is the Cartesian product of var.envs_folders × var.tenants ("${e}-${t}"). Defining iac_project_org_policies and main_project_org_policies directly on var.tenants[tenant] applies the same project exception across all environments (dev, test, prod), making it impossible to grant a dev-only project exception without also loosening prod.


Recommended Implementation

Instead of adding inline map(any) attributes to var.envs_folders and var.tenants:

  1. Remove folder-level overrides: Revert the changes in fast/stages-aw/1-resman/branch-envs.tf, var.envs_folders, and module.tenant-top-folders so organization policy exceptions cannot be applied broadly at the environment or tenant folder level.
  2. Use var.factories_config.org_policies: Add org_policies = optional(string, "data/org-policies") to var.factories_config in fast/stages-aw/1-resman/variables.tf (matching the pattern used in 0-bootstrap), leaving var.envs_folders and var.tenants unchanged.
  3. Wire project-scoped factory paths in branch-tenants.tf: Pass factories_config to module.tenant-self-iac-projects and module.tenant-self-main-projects using each project's environment-scoped name:
    • tenant-self-iac-projects: factories_config = { org_policies = "${var.factories_config.org_policies}/${lower("${each.key}-iac-core-0")}" }
    • tenant-self-main-projects: factories_config = { org_policies = "${var.factories_config.org_policies}/${lower("${each.key}-main-0")}" }
  4. Update documentation: Also fix the double-commented # # tfdoc:file:description header on line 17 of fast/stages-aw/1-resman/branch-tenants.tf and regenerate fast/stages-aw/1-resman/README.md with tools/tfdoc.py.

Because modules/project uses try(fileset(..., "*.yaml"), []), non-existent directories are safely ignored, boolean and list policies can be freely mixed in YAML files without Terraform type-unification errors, and exceptions are naturally scoped to an individual <env>-<tenant> project (e.g., data/org-policies/dev-team-a-main-0/policies.yaml).

@aghassemlouei
aghassemlouei force-pushed the feat/resman-org-policy-exceptions branch from b70f24e to 4689999 Compare October 28, 2026 00:18
@aghassemlouei aghassemlouei changed the title feat(1-resman): support folder and project organization policy overrides feat(1-resman): support project organization policy overrides Oct 28, 2026
@aghassemlouei

Copy link
Copy Markdown
Member Author

Updated the branch to remove the folder-level overrides, wire project-scoped var.factories_config.org_policies paths on tenant-self-iac-projects and tenant-self-main-projects, and refresh the branch-tenants.tf header and README.md. Please take another look when you have a moment!

@Calvin-Cheng1
Calvin-Cheng1 merged commit db8271c into main Oct 28, 2026
23 checks passed
@Calvin-Cheng1
Calvin-Cheng1 deleted the feat/resman-org-policy-exceptions branch October 28, 2026 03:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement New feature or request Level of Effort - Medium Moderate task requiring thought and testing; typically takes a couple of days to a week 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.

[Feature Request] Allow Organization policy exceptions at folder/project level

2 participants