From ff3724429a04b54d25bfea6eb3db68d78d1128bb Mon Sep 17 00:00:00 2001 From: David Gleich Date: Mon, 24 Oct 2022 19:03:17 +0200 Subject: [PATCH] feat:make compression default for backups for mysql and postgresql --- examples/mysql-backup-create-service-account/main.tf | 2 +- modules/backup/README.md | 2 +- modules/backup/variables.tf | 3 +-- .../mysql_backup_create_service_account_test.go | 2 +- .../postgresql_backup_provided_service_account_test.go | 2 +- 5 files changed, 5 insertions(+), 6 deletions(-) diff --git a/examples/mysql-backup-create-service-account/main.tf b/examples/mysql-backup-create-service-account/main.tf index 4458a781..0f7c183e 100644 --- a/examples/mysql-backup-create-service-account/main.tf +++ b/examples/mysql-backup-create-service-account/main.tf @@ -51,5 +51,5 @@ module "backup" { backup_retention_time = 1 backup_schedule = "5 * * * *" export_schedule = "10 * * * *" - compress_export = true + compress_export = false } diff --git a/modules/backup/README.md b/modules/backup/README.md index b3eed7dc..a49b18af 100644 --- a/modules/backup/README.md +++ b/modules/backup/README.md @@ -55,7 +55,7 @@ fetch workflows.googleapis.com/Workflow |------|-------------|------|---------|:--------:| | backup\_retention\_time | The number of days backups should be kept | `number` | `30` | no | | backup\_schedule | The cron schedule to execute the internal backup | `string` | `"45 2 * * *"` | no | -| compress\_export | Whether or not to compress the export when storing in the bucket; Only valid for MySQL and PostgreSQL | `bool` | `false` | no | +| compress\_export | Whether or not to compress the export when storing in the bucket; Only valid for MySQL and PostgreSQL | `bool` | `true` | no | | enable\_export\_backup | Weather to create exports to GCS Buckets with this module | `bool` | `true` | no | | enable\_internal\_backup | Wether to create internal backups with this module | `bool` | `true` | no | | export\_databases | The list of databases that should be exported - if is an empty set all databases will be exported | `set(string)` | `[]` | no | diff --git a/modules/backup/variables.tf b/modules/backup/variables.tf index 17088779..b1558a4c 100644 --- a/modules/backup/variables.tf +++ b/modules/backup/variables.tf @@ -88,9 +88,8 @@ variable "export_uri" { } } -#TODO: gleichda change default to true on next major release (#336) variable "compress_export" { description = "Whether or not to compress the export when storing in the bucket; Only valid for MySQL and PostgreSQL" type = bool - default = false + default = true } diff --git a/test/integration/mysql-backup-create-service-account/mysql_backup_create_service_account_test.go b/test/integration/mysql-backup-create-service-account/mysql_backup_create_service_account_test.go index 11e57c6c..a9bc7774 100644 --- a/test/integration/mysql-backup-create-service-account/mysql_backup_create_service_account_test.go +++ b/test/integration/mysql-backup-create-service-account/mysql_backup_create_service_account_test.go @@ -55,7 +55,7 @@ func TestMySqlBackupModuleCreateServiceAccount(t *testing.T) { fmt.Sprintf("instance: %s", instanceName), fmt.Sprintf("project: %s", projectID), "- backupTime: ${string(int(sys.now()))}", - fmt.Sprintf("uri: ${\"gs://%s-backup/%[1]s-\" + backupTime + \".sql.gz\"}", instanceName), + fmt.Sprintf("uri: ${\"gs://%s-backup/%[1]s-\" + backupTime + \".sql\"}", instanceName), } for _, expected := range backupContainsExpecations { diff --git a/test/integration/postgresql-backup-provided-service-account/postgresql_backup_provided_service_account_test.go b/test/integration/postgresql-backup-provided-service-account/postgresql_backup_provided_service_account_test.go index b1c2659e..ba06828b 100644 --- a/test/integration/postgresql-backup-provided-service-account/postgresql_backup_provided_service_account_test.go +++ b/test/integration/postgresql-backup-provided-service-account/postgresql_backup_provided_service_account_test.go @@ -53,7 +53,7 @@ func TestPostgresqlBackupModuleProvidedServiceAccount(t *testing.T) { fmt.Sprintf("instance: %s", instanceName), fmt.Sprintf("project: %s", projectID), "- backupTime: ${string(int(sys.now()))}", - fmt.Sprintf("uri: ${\"gs://%s-backup/%[1]s-\" + database + \"-\" + backupTime + \".sql\"}", instanceName), + fmt.Sprintf("uri: ${\"gs://%s-backup/%[1]s-\" + database + \"-\" + backupTime + \".sql.gz\"}", instanceName), } for _, expected := range backupContainsExpecations {