Skip to content

Commit a074efc

Browse files
authored
fix: add retain_backups_on_delete to mssql submodule (#764)
1 parent f0a2571 commit a074efc

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

modules/mssql/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ module "mssql" {
7474
| project\_id | The project ID to manage the Cloud SQL resources | `string` | n/a | yes |
7575
| random\_instance\_name | Sets random suffix at the end of the Cloud SQL resource name | `bool` | `false` | no |
7676
| region | The region of the Cloud SQL resources | `string` | `"us-central1"` | no |
77+
| retain\_backups\_on\_delete | When this parameter is set to true, Cloud SQL retains backups of the instance even after the instance is deleted. The ON\_DEMAND backup will be retained until customer deletes the backup or the project. The AUTOMATED backup will be retained based on the backups retention setting. | `bool` | `false` | no |
7778
| root\_password | MSSERVER password for the root user. If not set, a random one will be generated and available in the root\_password output variable. | `string` | `""` | no |
7879
| secondary\_zone | The preferred zone for the read replica instance, it should be something like: `us-central1-a`, `us-east1-c`. | `string` | `null` | no |
7980
| sql\_server\_audit\_config | SQL server audit config settings. | `map(string)` | `{}` | no |

modules/mssql/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ resource "google_sql_database_instance" "default" {
6363
deletion_protection_enabled = var.deletion_protection_enabled
6464
connector_enforcement = local.connector_enforcement
6565
enable_dataplex_integration = var.enable_dataplex_integration
66+
retain_backups_on_delete = var.retain_backups_on_delete
6667

6768
dynamic "backup_configuration" {
6869
for_each = !local.is_secondary_instance && var.backup_configuration.enabled ? [var.backup_configuration] : []

modules/mssql/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,12 @@ variable "backup_configuration" {
241241
}
242242
}
243243

244+
variable "retain_backups_on_delete" {
245+
description = "When this parameter is set to true, Cloud SQL retains backups of the instance even after the instance is deleted. The ON_DEMAND backup will be retained until customer deletes the backup or the project. The AUTOMATED backup will be retained based on the backups retention setting."
246+
type = bool
247+
default = false
248+
}
249+
244250
variable "db_name" {
245251
description = "The name of the default database to create"
246252
type = string

0 commit comments

Comments
 (0)