diff --git a/modules/net-vpc-factory/factory-projects-object.tf b/modules/net-vpc-factory/factory-projects-object.tf
index cbc9685ea..ed2770b0e 100644
--- a/modules/net-vpc-factory/factory-projects-object.tf
+++ b/modules/net-vpc-factory/factory-projects-object.tf
@@ -27,6 +27,7 @@ locals {
data_defaults = merge({
billing_account = null
contacts = {}
+ deletion_policy = null
factories_config = merge({
custom_roles = null
observability = null
@@ -82,6 +83,7 @@ locals {
data_overrides = merge({
billing_account = null
contacts = null
+ deletion_policy = null
factories_config = merge({
custom_roles = null
observability = null
@@ -131,6 +133,11 @@ locals {
try(v.billing_account, null),
local.__projects_config.data_defaults.billing_account
), null)
+ deletion_policy = try(coalesce( # type: string
+ local.__projects_config.data_overrides.deletion_policy,
+ try(v.deletion_policy, null),
+ local.__projects_config.data_defaults.deletion_policy
+ ), null)
contacts = coalesce( # type: map
local.__projects_config.data_overrides.contacts,
try(v.contacts, null),
diff --git a/modules/project-factory/README.md b/modules/project-factory/README.md
index 8165d0697..64690cefe 100644
--- a/modules/project-factory/README.md
+++ b/modules/project-factory/README.md
@@ -494,10 +494,10 @@ service_accounts:
| name | description | type | required | default |
|---|---|:---:|:---:|:---:|
-| [factories_config](variables.tf#L121) | Path to folder with YAML resource description data files. | object({…}) | ✓ | |
-| [data_defaults](variables.tf#L17) | Optional default values used when corresponding project data from files are missing. | object({…}) | | {} |
-| [data_merges](variables.tf#L64) | Optional values that will be merged with corresponding data from files. Combines with `data_defaults`, file data, and `data_overrides`. | object({…}) | | {} |
-| [data_overrides](variables.tf#L83) | Optional values that override corresponding data from files. Takes precedence over file data and `data_defaults`. | object({…}) | | {} |
+| [factories_config](variables.tf#L123) | Path to folder with YAML resource description data files. | object({…}) | ✓ | |
+| [data_defaults](variables.tf#L17) | Optional default values used when corresponding project data from files are missing. | object({…}) | | {} |
+| [data_merges](variables.tf#L65) | Optional values that will be merged with corresponding data from files. Combines with `data_defaults`, file data, and `data_overrides`. | object({…}) | | {} |
+| [data_overrides](variables.tf#L84) | Optional values that override corresponding data from files. Takes precedence over file data and `data_defaults`. | object({…}) | | {} |
## Outputs
diff --git a/modules/project-factory/factory-projects-object.tf b/modules/project-factory/factory-projects-object.tf
index cbc9685ea..ed2770b0e 100644
--- a/modules/project-factory/factory-projects-object.tf
+++ b/modules/project-factory/factory-projects-object.tf
@@ -27,6 +27,7 @@ locals {
data_defaults = merge({
billing_account = null
contacts = {}
+ deletion_policy = null
factories_config = merge({
custom_roles = null
observability = null
@@ -82,6 +83,7 @@ locals {
data_overrides = merge({
billing_account = null
contacts = null
+ deletion_policy = null
factories_config = merge({
custom_roles = null
observability = null
@@ -131,6 +133,11 @@ locals {
try(v.billing_account, null),
local.__projects_config.data_defaults.billing_account
), null)
+ deletion_policy = try(coalesce( # type: string
+ local.__projects_config.data_overrides.deletion_policy,
+ try(v.deletion_policy, null),
+ local.__projects_config.data_defaults.deletion_policy
+ ), null)
contacts = coalesce( # type: map
local.__projects_config.data_overrides.contacts,
try(v.contacts, null),
diff --git a/modules/project-factory/main.tf b/modules/project-factory/main.tf
index 93372600b..8b5abb6da 100644
--- a/modules/project-factory/main.tf
+++ b/modules/project-factory/main.tf
@@ -37,6 +37,7 @@ module "projects" {
source = "../project"
for_each = local.projects
billing_account = each.value.billing_account
+ deletion_policy = each.value.deletion_policy
name = each.value.name
parent = lookup(
local.context.folder_ids, each.value.parent, each.value.parent
diff --git a/modules/project-factory/schemas/project.schema.json b/modules/project-factory/schemas/project.schema.json
index fc00d4368..2da7b7906 100644
--- a/modules/project-factory/schemas/project.schema.json
+++ b/modules/project-factory/schemas/project.schema.json
@@ -85,6 +85,10 @@
}
}
},
+ "deletion_policy": {
+ "type": "string",
+ "enum": ["PREVENT", "DELETE", "ABANDON"]
+ },
"iam": {
"$ref": "#/$defs/iam"
},
diff --git a/modules/project-factory/variables.tf b/modules/project-factory/variables.tf
index cd76d2d17..54cfceab0 100644
--- a/modules/project-factory/variables.tf
+++ b/modules/project-factory/variables.tf
@@ -19,6 +19,7 @@ variable "data_defaults" {
type = object({
billing_account = optional(string)
contacts = optional(map(list(string)), {})
+ deletion_policy = optional(string)
factories_config = optional(object({
custom_roles = optional(string)
observability = optional(string)
@@ -86,6 +87,7 @@ variable "data_overrides" {
# data overrides default to null to mark that they should not override
billing_account = optional(string)
contacts = optional(map(list(string)))
+ deletion_policy = optional(string)
factories_config = optional(object({
custom_roles = optional(string)
observability = optional(string)
diff --git a/tests/modules/alloydb/examples/psc.yaml b/tests/modules/alloydb/examples/psc.yaml
index d142c971a..1866d7dc3 100644
--- a/tests/modules/alloydb/examples/psc.yaml
+++ b/tests/modules/alloydb/examples/psc.yaml
@@ -1,4 +1,4 @@
-# Copyright 2024 Google LLC
+# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -50,7 +50,6 @@ values:
labels: null
machine_config:
- cpu_count: 2
- network_config: []
psc_instance_config:
- allowed_consumer_projects:
- '123'