Merge pull request #331 from caiotavaresdito/feature/cloudsql-backup_configuration
Feature/cloudsql backup configuration
This commit is contained in:
commit
3b2de4921e
|
@ -104,7 +104,7 @@ module "db" {
|
|||
| tier | The machine type to use for the instances. | <code title="">string</code> | ✓ | |
|
||||
| *authorized_networks* | Map of NAME=>CIDR_RANGE to allow to connect to the database(s). | <code title="map(string)">map(string)</code> | | <code title="">null</code> |
|
||||
| *availability_type* | Availability type for the primary replica. Either `ZONAL` or `REGIONAL` | <code title="">string</code> | | <code title="">ZONAL</code> |
|
||||
| *backup_configuration* | Backup settings for primary instance. Will be automatically enabled if using MySQL with one or more replicas | <code title="object({ enabled = bool binary_log_enabled = bool })">object({...})</code> | | <code title="{ enabled = false binary_log_enabled = false }">...</code> |
|
||||
| *backup_configuration* | Backup settings for primary instance. Will be automatically enabled if using MySQL with one or more replicas | <code title="object({ enabled = bool binary_log_enabled = bool start_time = string location = string log_retention_days = number retention_count = number })">object({...})</code> | | <code title="{ enabled = false binary_log_enabled = false start_time = "23:00" location = "EU" log_retention_days = 7 retention_count = 7 }">...</code> |
|
||||
| *databases* | Databases to create once the primary instance is created. | <code title="list(string)">list(string)</code> | | <code title="">null</code> |
|
||||
| *deletion_protection* | Allow terraform to delete instances. | <code title="">bool</code> | | <code title="">false</code> |
|
||||
| *disk_size* | Disk size in GB. Set to null to enable autoresize. | <code title="">number</code> | | <code title="">null</code> |
|
||||
|
|
|
@ -77,6 +77,13 @@ resource "google_sql_database_instance" "primary" {
|
|||
? var.backup_configuration.binary_log_enabled || local.has_replicas
|
||||
: null
|
||||
)
|
||||
start_time = var.backup_configuration.start_time
|
||||
location = var.backup_configuration.location
|
||||
transaction_log_retention_days = var.backup_configuration.log_retention_days
|
||||
backup_retention_settings {
|
||||
retained_backups = var.backup_configuration.retention_count
|
||||
retention_unit = "COUNT"
|
||||
}
|
||||
}
|
||||
|
||||
dynamic "database_flags" {
|
||||
|
|
|
@ -31,13 +31,22 @@ variable "backup_configuration" {
|
|||
type = object({
|
||||
enabled = bool
|
||||
binary_log_enabled = bool
|
||||
start_time = string
|
||||
location = string
|
||||
log_retention_days = number
|
||||
retention_count = number
|
||||
})
|
||||
default = {
|
||||
enabled = false
|
||||
binary_log_enabled = false
|
||||
start_time = "23:00"
|
||||
location = "EU"
|
||||
log_retention_days = 7
|
||||
retention_count = 7
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
variable "database_version" {
|
||||
description = "Database type and version to create."
|
||||
type = string
|
||||
|
|
|
@ -28,10 +28,18 @@ variable "backup_configuration" {
|
|||
type = object({
|
||||
enabled = bool
|
||||
binary_log_enabled = bool
|
||||
start_time = string
|
||||
location = string
|
||||
log_retention_days = number
|
||||
retention_count = number
|
||||
})
|
||||
default = {
|
||||
enabled = false
|
||||
binary_log_enabled = false
|
||||
start_time = "23:00"
|
||||
location = "EU"
|
||||
log_retention_days = 7
|
||||
retention_count = 7
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue