From eeed05160d49a9958c1711fece08036686b5674f Mon Sep 17 00:00:00 2001 From: Willis Zhang Date: Mon, 26 Oct 2026 08:38:13 -0400 Subject: [PATCH] feat(0-bootstrap): make compute.restrictVpcPeering producers configurable Private services access peers VPC networks with Google producer networks, so compute.restrictVpcPeering has to allow the producer folder. Stage 0 hard-coded the Service Networking producer folder next to a blog link. Add org_policies_config.constraints.allowed_vpc_peering_producers. It defaults to ["under:folders/832634261155"], so the rendered policy doesn't change. Deployments can add other Google producers, or set it to [] if they use only Private Service Connect. Replace the blog link with a comment that cites the constraint reference, the private services access overview and the Private Service Connect security page, and points at the #352 review for other producer IDs. --- fast/stages-aw/0-bootstrap/README.md | 18 +++++++++--------- .../custom-org-policies/networking_policy.yaml | 17 ++++++++++++++++- fast/stages-aw/0-bootstrap/organization.tf | 1 + .../0-bootstrap/terraform.tfvars.sample | 1 + fast/stages-aw/0-bootstrap/variables.tf | 1 + 5 files changed, 28 insertions(+), 10 deletions(-) diff --git a/fast/stages-aw/0-bootstrap/README.md b/fast/stages-aw/0-bootstrap/README.md index a2f2e6f2e..71e817a6b 100644 --- a/fast/stages-aw/0-bootstrap/README.md +++ b/fast/stages-aw/0-bootstrap/README.md @@ -408,8 +408,8 @@ The `fast_features` variable consists of 4 toggles | [billing_account](variables.tf#L35) | Billing account id. If billing account is not part of the same org set `is_org_level` to `false`. To disable handling of billing IAM roles set `no_iam` to `true`. | object({…}) | ✓ | | | [bootstrap_project](variables.tf#L63) | Bootstrap project ID. | string | ✓ | | | [kms_protection_level](variables.tf#L236) | KMS protection level. | string | ✓ | | -| [organization](variables.tf#L323) | Organization details. | object({…}) | ✓ | | -| [prefix](variables.tf#L338) | Prefix used for resources that need unique names. Use 7 characters or less. | string | ✓ | | +| [organization](variables.tf#L324) | Organization details. | object({…}) | ✓ | | +| [prefix](variables.tf#L339) | Prefix used for resources that need unique names. Use 7 characters or less. | string | ✓ | | | [assured_workloads](variables.tf#L22) | Configuration for Assured Workloads. | object({…}) | | {…} | | [billing_budget_amount](variables.tf#L45) | Optional Budget configuration for the AW folder. Includes amount and optional threshold rules (defaults to 0.5, 0.75, 0.9). If null, no budget will be created. | object({…}) | | null | | [billing_override](variables.tf#L54) | Optional billing override configuration. If set, disables service account impersonation for project billing linkage and runs under the user account using the specified quota projects. | object({…}) | | null | @@ -429,13 +429,13 @@ The `fast_features` variable consists of 4 toggles | [log_sinks](variables.tf#L258) | Org-level log sinks, in name => {type, filter} format. Valid types: 'logging' (routes to Cloud Logging bucket with 365-day default retention), 'pubsub' (routes to Pub/Sub topic with 7-day default retention; requires an active consumer to avoid log loss), 'storage' (routes to GCS bucket), 'bigquery' (routes to BigQuery dataset). | map(object({…})) | | {…} | | [logging_bucket_retention](variables.tf#L294) | Retention period (in days) for the Cloud Logging buckets created for organization log exports. | number | | 365 | | [logging_kms_key](variables.tf#L300) | value of the KMS key used for logging. | string | | null | -| [org_policies_config](variables.tf#L306) | Organization policies customization. | object({…}) | | {} | -| [outputs_location](variables.tf#L332) | Enable writing provider, tfvars and CI/CD workflow files to local filesystem. Leave null to disable. | string | | null | -| [project_deletion_policies](variables.tf#L347) | Deletion policy of each Stage 0 project. Use ABANDON for projects that you create outside Terraform and import, so terraform destroy leaves them in place. | object({…}) | | {} | -| [project_parent_ids](variables.tf#L365) | Optional parents for projects created here in folders/nnnnnnn format. Null values will use the organization as parent. | object({…}) | | {} | -| [regime_mapping](variables.tf#L376) | Mapping of compliance regime names to short codes. | map(string) | | {…} | -| [regions](variables.tf#L409) | Region definitions. Must be specified in terraform.tfvars. Example: us-east4 for FedRAMP High compliance. | object({…}) | | {…} | -| [workforce_identity_pool](variables.tf#L420) | Workforce Identity Federation pool configuration. | object({…}) | | null | +| [org_policies_config](variables.tf#L306) | Organization policies customization. | object({…}) | | {} | +| [outputs_location](variables.tf#L333) | Enable writing provider, tfvars and CI/CD workflow files to local filesystem. Leave null to disable. | string | | null | +| [project_deletion_policies](variables.tf#L348) | Deletion policy of each Stage 0 project. Use ABANDON for projects that you create outside Terraform and import, so terraform destroy leaves them in place. | object({…}) | | {} | +| [project_parent_ids](variables.tf#L366) | Optional parents for projects created here in folders/nnnnnnn format. Null values will use the organization as parent. | object({…}) | | {} | +| [regime_mapping](variables.tf#L377) | Mapping of compliance regime names to short codes. | map(string) | | {…} | +| [regions](variables.tf#L410) | Region definitions. Must be specified in terraform.tfvars. Example: us-east4 for FedRAMP High compliance. | object({…}) | | {…} | +| [workforce_identity_pool](variables.tf#L421) | Workforce Identity Federation pool configuration. | object({…}) | | null | ## Outputs diff --git a/fast/stages-aw/0-bootstrap/data/custom-org-policies/networking_policy.yaml b/fast/stages-aw/0-bootstrap/data/custom-org-policies/networking_policy.yaml index 4097e6284..c16e82c78 100644 --- a/fast/stages-aw/0-bootstrap/data/custom-org-policies/networking_policy.yaml +++ b/fast/stages-aw/0-bootstrap/data/custom-org-policies/networking_policy.yaml @@ -67,12 +67,27 @@ compute.restrictPartnerInterconnectUsage: # under:projects/PROJECT_ID, # or projects/PROJECT_ID/global/networks/NETWORK_NAME. # SHOULD HAVE +# +# Private services access (Cloud SQL, AlloyDB, Memorystore, Filestore and other +# services) connects your VPC networks to Google producer networks with VPC +# Network Peering. This policy also allows the values in +# org_policies_config.constraints.allowed_vpc_peering_producers. The default, +# under:folders/832634261155, is Google's Service Networking producer folder, +# which private services access peers with. Set the list to [] if you use only +# Private Service Connect. +# https://docs.cloud.google.com/organization-policy/reference/org-policy-constraints#constraints/compute.restrictVpcPeering +# https://docs.cloud.google.com/vpc/docs/private-services-access +# https://docs.cloud.google.com/vpc/docs/private-service-connect-security#org-policy-organization +# Producer IDs for other Google services, and Google's producer organization: +# https://github.com/google/stellar-engine/pull/352#pullrequestreview-5646224651 compute.restrictVpcPeering: rules: - allow: values: - under:organizations/${organization_id} - - under:folders/832634261155 # https://autonomousthingz-life.medium.com/google-cloud-organisation-policies-get-the-restrict-vpc-peering-usage-organisation-policy-d87dce84a5e7 +%{ for producer in allowed_vpc_peering_producers ~} + - ${producer} +%{ endfor ~} %{ if !contains(["FEDRAMP_MODERATE"], regime) ~} # This list constraint defines the type of protocol forwarding rule objects diff --git a/fast/stages-aw/0-bootstrap/organization.tf b/fast/stages-aw/0-bootstrap/organization.tf index e311f5c5d..81054e4ef 100644 --- a/fast/stages-aw/0-bootstrap/organization.tf +++ b/fast/stages-aw/0-bootstrap/organization.tf @@ -123,6 +123,7 @@ locals { customer_id : var.organization.customer_id drs_tag_name : local.drs_tag_name allowed_domains : var.org_policies_config.constraints.allowed_policy_member_domains + allowed_vpc_peering_producers : var.org_policies_config.constraints.allowed_vpc_peering_producers regime : var.assured_workloads.regime })) ] diff --git a/fast/stages-aw/0-bootstrap/terraform.tfvars.sample b/fast/stages-aw/0-bootstrap/terraform.tfvars.sample index 0a32ddc96..9daf4c9ad 100644 --- a/fast/stages-aw/0-bootstrap/terraform.tfvars.sample +++ b/fast/stages-aw/0-bootstrap/terraform.tfvars.sample @@ -59,6 +59,7 @@ org_policies_config = { import_defaults = false # No policies to import as of 27 SEP 2024 constraints = { allowed_policy_member_domains = [] #Update with additional customer IDs if needed + allowed_vpc_peering_producers = ["under:folders/832634261155"] # Google's Service Networking producer folder. Add other Google producers if needed } } diff --git a/fast/stages-aw/0-bootstrap/variables.tf b/fast/stages-aw/0-bootstrap/variables.tf index 712931723..dd609720e 100644 --- a/fast/stages-aw/0-bootstrap/variables.tf +++ b/fast/stages-aw/0-bootstrap/variables.tf @@ -308,6 +308,7 @@ variable "org_policies_config" { type = object({ constraints = optional(object({ allowed_policy_member_domains = optional(list(string), []) + allowed_vpc_peering_producers = optional(list(string), ["under:folders/832634261155"]) }), {}) import_defaults = optional(bool, false) tag_name = optional(string, "org-policies")