Skip to content

Commit

Permalink
Add continuousBackupConfig and continuousBackupInfo to AlloyDB cluster (
Browse files Browse the repository at this point in the history
#8406)

* Properly handle ABP midnight (hours = 0)

* Add ExpectNonEmptyPlan to test

* Add continuous backup config to alloydb cluster

* add more unit tests

* Adding more tests

* Fix cluster.yaml lint

* Add default value and update cmek test

* Update test to use kms key bootstrapping util

* condense update tests

* Change encryptionType output field to string

* use two different keys

* Only update encryption in CBR
  • Loading branch information
GoogleMarcfont authored Aug 1, 2023
1 parent 024b343 commit ed8f2d4
Show file tree
Hide file tree
Showing 3 changed files with 429 additions and 3 deletions.
72 changes: 69 additions & 3 deletions mmv1/products/alloydb/Cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,44 @@ properties:
description: |
Output only. Cloud KMS key versions that are being used to protect the database or the backup.
output: true
- !ruby/object:Api::Type::NestedObject
name: 'continuousBackupInfo'
description: |
ContinuousBackupInfo describes the continuous backup properties of a cluster.
output: true
properties:
- !ruby/object:Api::Type::String
name: enabledTime
description: |
When ContinuousBackup was most recently enabled. Set to null if ContinuousBackup is not enabled.
output: true
- !ruby/object:Api::Type::Array
name: schedule
item_type: Api::Type::String
description: |
Days of the week on which a continuous backup is taken. Output only field. Ignored if passed into the request.
output: true
- !ruby/object:Api::Type::String
name: earliestRestorableTime
description: |
The earliest restorable time that can be restored to. Output only field.
output: true
- !ruby/object:Api::Type::NestedObject
name: 'encryptionInfo'
description: |
Output only. The encryption information for the WALs and backups required for ContinuousBackup.
output: true
properties:
- !ruby/object:Api::Type::String
name: 'encryptionType'
description: 'Output only. Type of encryption.'
output: true
- !ruby/object:Api::Type::Array
name: kmsKeyVersions
item_type: Api::Type::String
description: |
Output only. Cloud KMS key versions that are being used to protect the database or the backup.
output: true
- !ruby/object:Api::Type::String
name: 'network'
required: true
Expand Down Expand Up @@ -156,11 +194,39 @@ properties:
required: true
sensitive: true
- !ruby/object:Api::Type::NestedObject
name: 'automatedBackupPolicy'
name: 'continuousBackupConfig'
default_from_api: true
description: |
The automated backup policy for this cluster.
The continuous backup config for this cluster.
If no policy is provided then the default policy will be used. The default policy takes one backup a day and retains backups for 14 days.
properties:
- !ruby/object:Api::Type::Boolean
name: enabled
send_empty_value: true
default_value: true
description: |
Whether continuous backup recovery is enabled. If not set, defaults to true.
- !ruby/object:Api::Type::Integer
name: recoveryWindowDays
default_from_api: true
description: |
The numbers of days that are eligible to restore from using PITR. To support the entire recovery window, backups and logs are retained for one day more than the recovery window.
If no policy is provided then the default policy will be used. The default policy takes one backup a day, has a backup window of 1 hour, and retains backups for 14 days.
If not set, defaults to 14 days.
- !ruby/object:Api::Type::NestedObject
name: 'encryptionConfig'
description: |
EncryptionConfig describes the encryption config of a cluster or a backup that is encrypted with a CMEK (customer-managed encryption key).
properties:
- !ruby/object:Api::Type::String
name: 'kmsKeyName'
description: |
The fully-qualified resource name of the KMS key. Each Cloud KMS key is regionalized and has the following format: projects/[PROJECT]/locations/[REGION]/keyRings/[RING]/cryptoKeys/[KEY_NAME].
- !ruby/object:Api::Type::NestedObject
name: 'automatedBackupPolicy'
description: |
The automated backup policy for this cluster. AutomatedBackupPolicy is disabled by default.
default_from_api: true
properties:
- !ruby/object:Api::Type::String
Expand Down
5 changes: 5 additions & 0 deletions mmv1/templates/terraform/examples/alloydb_cluster_full.tf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ resource "google_alloydb_cluster" "<%= ctx[:primary_resource_id] %>" {
password = "<%= ctx[:vars]['alloydb_cluster_name'] %>"
}

continuous_backup_config {
enabled = true
recovery_window_days = 14
}

automated_backup_policy {
location = "us-central1"
backup_window = "1800s"
Expand Down
Loading

0 comments on commit ed8f2d4

Please sign in to comment.