An AlloyDB Backup.
To get more information about Backup, see:
resource "google_alloydb_backup" "default" {
location = "us-central1"
backup_id = "alloydb-backup"
cluster_name = google_alloydb_cluster.default.name
depends_on = [google_alloydb_instance.default]
}
resource "google_alloydb_cluster" "default" {
cluster_id = "alloydb-cluster"
location = "us-central1"
network = google_compute_network.default.id
}
resource "google_alloydb_instance" "default" {
cluster = google_alloydb_cluster.default.name
instance_id = "alloydb-instance"
instance_type = "PRIMARY"
depends_on = [google_service_networking_connection.vpc_connection]
}
resource "google_compute_global_address" "private_ip_alloc" {
name = "alloydb-cluster"
address_type = "INTERNAL"
purpose = "VPC_PEERING"
prefix_length = 16
network = google_compute_network.default.id
}
resource "google_service_networking_connection" "vpc_connection" {
network = google_compute_network.default.id
service = "servicenetworking.googleapis.com"
reserved_peering_ranges = [google_compute_global_address.private_ip_alloc.name]
}
resource "google_compute_network" "default" {
name = "alloydb-network"
}
resource "google_alloydb_backup" "default" {
location = "us-central1"
backup_id = "alloydb-backup"
cluster_name = google_alloydb_cluster.default.name
description = "example description"
type = "ON_DEMAND"
labels = {
"label" = "key"
}
depends_on = [google_alloydb_instance.default]
}
resource "google_alloydb_cluster" "default" {
cluster_id = "alloydb-cluster"
location = "us-central1"
network = google_compute_network.default.id
}
resource "google_alloydb_instance" "default" {
cluster = google_alloydb_cluster.default.name
instance_id = "alloydb-instance"
instance_type = "PRIMARY"
depends_on = [google_service_networking_connection.vpc_connection]
}
resource "google_compute_global_address" "private_ip_alloc" {
name = "alloydb-cluster"
address_type = "INTERNAL"
purpose = "VPC_PEERING"
prefix_length = 16
network = google_compute_network.default.id
}
resource "google_service_networking_connection" "vpc_connection" {
network = google_compute_network.default.id
service = "servicenetworking.googleapis.com"
reserved_peering_ranges = [google_compute_global_address.private_ip_alloc.name]
}
resource "google_compute_network" "default" {
name = "alloydb-network"
}
The following arguments are supported:
cluster_name
-
(Required)
The full resource name of the backup source cluster (e.g., projects/{project}/locations/{location}/clusters/{clusterId}).
backup_id
-
(Required)
The ID of the alloydb backup.
location
-
(Required)
The location where the alloydb backup should reside.
display_name
-
(Optional)
User-settable and human-readable display name for the Backup.
labels
-
(Optional)
User-defined labels for the alloydb backup. An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.
Note: This field is non-authoritative, and will only manage the labels present in your configuration.
Please refer to the field effective_labels
for all of the labels present on the resource.
type
-
(Optional)
The backup type, which suggests the trigger for the backup.
Possible values are: TYPE_UNSPECIFIED
, ON_DEMAND
, AUTOMATED
, CONTINUOUS
.
description
-
(Optional)
User-provided description of the backup.
encryption_config
-
(Optional)
EncryptionConfig describes the encryption config of a cluster or a backup that is encrypted with a CMEK (customer-managed encryption key).
Structure is documented below.
annotations
-
(Optional)
Annotations to allow client tools to store small amount of arbitrary data. This is distinct from labels. https://google.aip.dev/128
An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.
Note: This field is non-authoritative, and will only manage the annotations present in your configuration.
Please refer to the field effective_annotations
for all of the annotations present on the resource.
project
- (Optional) The ID of the project in which the resource belongs.
If it is not provided, the provider project is used.
The encryption_config
block supports:
kms_key_name
-
(Optional)
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].In addition to the arguments listed above, the following computed attributes are exported:
id
- an identifier for the resource with format projects/{{project}}/locations/{{location}}/backups/{{backup_id}}
name
-
Output only. The name of the backup resource with the format: * projects/{project}/locations/{region}/backups/{backupId}
uid
-
Output only. The system-generated UID of the resource. The UID is assigned when the resource is created, and it is retained until it is deleted.
create_time
-
Output only. Create time stamp. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits.
Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".
update_time
-
Output only. Update time stamp. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits.
Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".
delete_time
-
Output only. Delete time stamp. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits.
Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".
state
-
Output only. The current state of the backup.
cluster_uid
-
Output only. The system-generated UID of the cluster which was used to create this resource.
reconciling
-
Output only. Reconciling (https://google.aip.dev/128#reconciliation), if true, indicates that the service is actively updating the resource.
This can happen due to user-triggered updates or system actions like failover or maintenance.
encryption_info
-
EncryptionInfo describes the encryption information of a cluster or a backup.
Structure is documented below.
etag
-
For Resource freshness validation (https://google.aip.dev/154)
size_bytes
-
Output only. The size of the backup in bytes.
expiry_time
-
Output only. The time at which after the backup is eligible to be garbage collected.
It is the duration specified by the backup's retention policy, added to the backup's createTime.
expiry_quantity
-
Output only. The QuantityBasedExpiry of the backup, specified by the backup's retention policy.
Once the expiry quantity is over retention, the backup is eligible to be garbage collected.
Structure is documented below.
terraform_labels
-
The combination of labels configured directly on the resource
and default labels configured on the provider.
effective_labels
-
All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Terraform, other clients and services.
effective_annotations
-
All of annotations (key/value pairs) present on the resource in GCP, including the annotations configured through Terraform, other clients and services.
The encryption_info
block contains:
encryption_type
-
(Output)
Output only. Type of encryption.
kms_key_versions
-
(Output)
Output only. Cloud KMS key versions that are being used to protect the database or the backup.
The expiry_quantity
block contains:
retention_count
-
(Output)
Output only. The backup's position among its backups with the same source cluster and type, by descending chronological order create time (i.e. newest first).
total_retention_count
-
(Output)
Output only. The length of the quantity-based queue, specified by the backup's retention policy.
This resource provides the following Timeouts configuration options:
create
- Default is 10 minutes.update
- Default is 10 minutes.delete
- Default is 10 minutes.Backup can be imported using any of these accepted formats:
projects/{{project}}/locations/{{location}}/backups/{{backup_id}}
{{project}}/{{location}}/{{backup_id}}
{{location}}/{{backup_id}}
In Terraform v1.5.0 and later, use an import
block to import Backup using one of the formats above. For example:
import {
id = "projects/{{project}}/locations/{{location}}/backups/{{backup_id}}"
to = google_alloydb_backup.default
}
When using the terraform import
command, Backup can be imported using one of the formats above. For example:
$ terraform import google_alloydb_backup.default projects/{{project}}/locations/{{location}}/backups/{{backup_id}}
$ terraform import google_alloydb_backup.default {{project}}/{{location}}/{{backup_id}}
$ terraform import google_alloydb_backup.default {{location}}/{{backup_id}}
This resource supports User Project Overrides.