Skip to content

googleAlloydbBackup

An AlloyDB Backup.

To get more information about Backup, see:

Example Usage - Alloydb Backup Basic

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
const dataGoogleComputeNetworkDefault =
  new google.dataGoogleComputeNetwork.DataGoogleComputeNetwork(
    this,
    "default",
    {
      name: "alloydb-network",
    }
  );
const googleAlloydbClusterDefault = new google.alloydbCluster.AlloydbCluster(
  this,
  "default_1",
  {
    cluster_id: "alloydb-cluster",
    location: "us-central1",
    network: dataGoogleComputeNetworkDefault.id,
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
googleAlloydbClusterDefault.overrideLogicalId("default");
const googleComputeGlobalAddressPrivateIpAlloc =
  new google.computeGlobalAddress.ComputeGlobalAddress(
    this,
    "private_ip_alloc",
    {
      address_type: "INTERNAL",
      name: "alloydb-cluster",
      network: dataGoogleComputeNetworkDefault.id,
      prefix_length: 16,
      purpose: "VPC_PEERING",
    }
  );
const googleServiceNetworkingConnectionVpcConnection =
  new google.serviceNetworkingConnection.ServiceNetworkingConnection(
    this,
    "vpc_connection",
    {
      network: dataGoogleComputeNetworkDefault.id,
      reserved_peering_ranges: [googleComputeGlobalAddressPrivateIpAlloc.name],
      service: "servicenetworking.googleapis.com",
    }
  );
const googleAlloydbInstanceDefault = new google.alloydbInstance.AlloydbInstance(
  this,
  "default_4",
  {
    cluster: googleAlloydbClusterDefault.name,
    depends_on: [`\${${googleServiceNetworkingConnectionVpcConnection.fqn}}`],
    instance_id: "alloydb-instance",
    instance_type: "PRIMARY",
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
googleAlloydbInstanceDefault.overrideLogicalId("default");
const googleAlloydbBackupDefault = new google.alloydbBackup.AlloydbBackup(
  this,
  "default_5",
  {
    backup_id: "alloydb-backup",
    cluster_name: googleAlloydbClusterDefault.name,
    depends_on: [`\${${googleAlloydbInstanceDefault.fqn}}`],
    location: "us-central1",
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
googleAlloydbBackupDefault.overrideLogicalId("default");

Example Usage - Alloydb Backup Full

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
const dataGoogleComputeNetworkDefault =
  new google.dataGoogleComputeNetwork.DataGoogleComputeNetwork(
    this,
    "default",
    {
      name: "alloydb-network",
    }
  );
const googleAlloydbClusterDefault = new google.alloydbCluster.AlloydbCluster(
  this,
  "default_1",
  {
    cluster_id: "alloydb-cluster",
    location: "us-central1",
    network: dataGoogleComputeNetworkDefault.id,
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
googleAlloydbClusterDefault.overrideLogicalId("default");
const googleComputeGlobalAddressPrivateIpAlloc =
  new google.computeGlobalAddress.ComputeGlobalAddress(
    this,
    "private_ip_alloc",
    {
      address_type: "INTERNAL",
      name: "alloydb-cluster",
      network: dataGoogleComputeNetworkDefault.id,
      prefix_length: 16,
      purpose: "VPC_PEERING",
    }
  );
const googleServiceNetworkingConnectionVpcConnection =
  new google.serviceNetworkingConnection.ServiceNetworkingConnection(
    this,
    "vpc_connection",
    {
      network: dataGoogleComputeNetworkDefault.id,
      reserved_peering_ranges: [googleComputeGlobalAddressPrivateIpAlloc.name],
      service: "servicenetworking.googleapis.com",
    }
  );
const googleAlloydbInstanceDefault = new google.alloydbInstance.AlloydbInstance(
  this,
  "default_4",
  {
    cluster: googleAlloydbClusterDefault.name,
    depends_on: [`\${${googleServiceNetworkingConnectionVpcConnection.fqn}}`],
    instance_id: "alloydb-instance",
    instance_type: "PRIMARY",
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
googleAlloydbInstanceDefault.overrideLogicalId("default");
const googleAlloydbBackupDefault = new google.alloydbBackup.AlloydbBackup(
  this,
  "default_5",
  {
    backup_id: "alloydb-backup",
    cluster_name: googleAlloydbClusterDefault.name,
    depends_on: [`\${${googleAlloydbInstanceDefault.fqn}}`],
    description: "example description",
    labels: [
      {
        label: "key",
      },
    ],
    location: "us-central1",
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
googleAlloydbBackupDefault.overrideLogicalId("default");

Argument Reference

The following arguments are supported:

  • clusterName - (Required) The full resource name of the backup source cluster (e.g., projects/{project}/locations/{location}/clusters/{clusterId}).

  • backupId - (Required) The ID of the alloydb backup.


  • labels - (Optional) User-defined labels for the alloydb backup.

  • description - (Optional) User-provided description of the backup.

  • location - (Optional) The location where the alloydb backup should reside.

  • project - (Optional) The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

Attributes Reference

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/{{backupId}}

  • 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.

  • createTime - Time the Backup was created in UTC.

  • updateTime - Time the Backup was updated in UTC.

  • state - The current state of the backup.

  • reconciling - 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.

  • etag - A hash of the resource.

Timeouts

This resource provides the following Timeouts configuration options:

  • create - Default is 10 minutes.
  • update - Default is 10 minutes.
  • delete - Default is 10 minutes.

Import

Backup can be imported using any of these accepted formats:

$ 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.