Skip to content

Commit

Permalink
fix: add deletion_protection to backup module and set it to false in …
Browse files Browse the repository at this point in the history
…intergration tests
  • Loading branch information
q2w committed Nov 22, 2024
1 parent 8cb3a03 commit 694241e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ module "backup" {
service_account = "${data.google_project.test_project.number}[email protected]"
create_notification_channel = false
notification_channels = [google_monitoring_notification_channel.email.id]
deletion_protection = false
}

data "google_project" "test_project" {
Expand Down
1 change: 1 addition & 0 deletions modules/backup/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ resource "google_workflows_workflow" "sql_backup" {
backupRetentionTime = var.backup_retention_time
backupRunsListMaxResults = var.backup_runs_list_max_results
})
deletion_protection = var.deletion_protection
}

resource "google_cloud_scheduler_job" "sql_backup" {
Expand Down
6 changes: 6 additions & 0 deletions modules/backup/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -192,3 +192,9 @@ variable "notification_channels" {
type = list(string)
default = []
}

variable "deletion_protection" {
description = "Whether Terraform will be prevented from destroying the workflow."
type = bool
default = true
}

0 comments on commit 694241e

Please sign in to comment.