google_alloydb_backup

An AlloyDB Backup.

To get more information about Backup, see:

Example Usage - Alloydb Backup Basic

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"
}

Example Usage - Alloydb Backup Full

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"
}

Argument Reference

The following arguments are supported:


The encryption_config block supports:

Attributes Reference

In addition to the arguments listed above, the following computed attributes are exported:

The encryption_info block contains:

The expiry_quantity block contains:

Timeouts

This resource provides the following Timeouts configuration options:

Import

Backup can be imported using any of these accepted formats:

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}}

User Project Overrides

This resource supports User Project Overrides.