Skip to content

Commit

Permalink
configure deletion_policy in project-factory
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-cit committed Oct 25, 2024
1 parent d6bab85 commit b8d5fd9
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ module "seed_project" {
create_project_sa = false
labels = var.project_labels
lien = true
deletion_policy = var.project_deletion_policy
}

module "enable_cross_project_service_account_usage" {
Expand Down
1 change: 1 addition & 0 deletions modules/cloudbuild/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ module "cloudbuild_project" {
billing_account = var.billing_account
activate_apis = local.activate_apis
labels = var.project_labels
deletion_policy = var.project_deletion_policy
}

/******************************************
Expand Down
6 changes: 6 additions & 0 deletions modules/cloudbuild/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ variable "project_id" {
type = string
}

variable "project_deletion_policy" {
description = "The deletion policy for the project created."
type = string
default = "PREVENT"
}

variable "activate_apis" {
description = "List of APIs to enable in the Cloudbuild project."
type = list(string)
Expand Down
1 change: 1 addition & 0 deletions modules/tf_cloudbuild_source/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ module "cloudbuild_project" {
billing_account = var.billing_account
activate_apis = local.activate_apis
labels = var.project_labels
deletion_policy = var.project_deletion_policy
}

// On the first run of cloud build submit, a bucket is automaticaly created with name "[PROJECT_ID]_cloudbuild"
Expand Down
6 changes: 6 additions & 0 deletions modules/tf_cloudbuild_source/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ variable "project_id" {
type = string
}

variable "project_deletion_policy" {
description = "The deletion policy for the project created."
type = string
default = "PREVENT"
}

variable "project_labels" {
description = "Labels to apply to the project."
type = map(string)
Expand Down
1 change: 1 addition & 0 deletions test/setup/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ module "project" {
org_id = var.org_id
folder_id = var.folder_id
billing_account = var.billing_account
deletion_policy = "DELETE"

activate_apis = [
"cloudresourcemanager.googleapis.com",
Expand Down
4 changes: 4 additions & 0 deletions test/setup/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,7 @@ output "random_testing_string" {
description = "Access the random ID created in setup for labeling other resources."
value = random_id.suffix.hex
}

output "project_deletion_policy" {
value = "DELETE"
}
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ variable "project_id" {
type = string
}

variable "project_deletion_policy" {
description = "The deletion policy for the project created."
type = string
default = "PREVENT"
}

variable "activate_apis" {
description = "List of APIs to enable in the seed project."
type = list(string)
Expand Down

0 comments on commit b8d5fd9

Please sign in to comment.