Cluster

class Cluster : KotlinCustomResource

A managed alloydb cluster. To get more information about Cluster, see:

Example Usage

Alloydb Cluster Basic

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.compute.Network;
import com.pulumi.gcp.alloydb.Cluster;
import com.pulumi.gcp.alloydb.ClusterArgs;
import com.pulumi.gcp.organizations.OrganizationsFunctions;
import com.pulumi.gcp.organizations.inputs.GetProjectArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var defaultNetwork = new Network("defaultNetwork");
var defaultCluster = new Cluster("defaultCluster", ClusterArgs.builder()
.clusterId("alloydb-cluster")
.location("us-central1")
.network(defaultNetwork.id())
.build());
final var project = OrganizationsFunctions.getProject();
}
}

Alloydb Cluster Full

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.compute.Network;
import com.pulumi.gcp.alloydb.Cluster;
import com.pulumi.gcp.alloydb.ClusterArgs;
import com.pulumi.gcp.alloydb.inputs.ClusterInitialUserArgs;
import com.pulumi.gcp.alloydb.inputs.ClusterContinuousBackupConfigArgs;
import com.pulumi.gcp.alloydb.inputs.ClusterAutomatedBackupPolicyArgs;
import com.pulumi.gcp.alloydb.inputs.ClusterAutomatedBackupPolicyWeeklyScheduleArgs;
import com.pulumi.gcp.alloydb.inputs.ClusterAutomatedBackupPolicyQuantityBasedRetentionArgs;
import com.pulumi.gcp.organizations.OrganizationsFunctions;
import com.pulumi.gcp.organizations.inputs.GetProjectArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var default_ = new Network("default");
var full = new Cluster("full", ClusterArgs.builder()
.clusterId("alloydb-cluster-full")
.location("us-central1")
.network(default_.id())
.initialUser(ClusterInitialUserArgs.builder()
.user("alloydb-cluster-full")
.password("alloydb-cluster-full")
.build())
.continuousBackupConfig(ClusterContinuousBackupConfigArgs.builder()
.enabled(true)
.recoveryWindowDays(14)
.build())
.automatedBackupPolicy(ClusterAutomatedBackupPolicyArgs.builder()
.location("us-central1")
.backupWindow("1800s")
.enabled(true)
.weeklySchedule(ClusterAutomatedBackupPolicyWeeklyScheduleArgs.builder()
.daysOfWeeks("MONDAY")
.startTimes(ClusterAutomatedBackupPolicyWeeklyScheduleStartTimeArgs.builder()
.hours(23)
.minutes(0)
.seconds(0)
.nanos(0)
.build())
.build())
.quantityBasedRetention(ClusterAutomatedBackupPolicyQuantityBasedRetentionArgs.builder()
.count(1)
.build())
.labels(Map.of("test", "alloydb-cluster-full"))
.build())
.labels(Map.of("test", "alloydb-cluster-full"))
.build());
final var project = OrganizationsFunctions.getProject();
}
}

Alloydb Cluster Restore

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.compute.ComputeFunctions;
import com.pulumi.gcp.compute.inputs.GetNetworkArgs;
import com.pulumi.gcp.alloydb.Cluster;
import com.pulumi.gcp.alloydb.ClusterArgs;
import com.pulumi.gcp.alloydb.inputs.ClusterInitialUserArgs;
import com.pulumi.gcp.compute.GlobalAddress;
import com.pulumi.gcp.compute.GlobalAddressArgs;
import com.pulumi.gcp.servicenetworking.Connection;
import com.pulumi.gcp.servicenetworking.ConnectionArgs;
import com.pulumi.gcp.alloydb.Instance;
import com.pulumi.gcp.alloydb.InstanceArgs;
import com.pulumi.gcp.alloydb.inputs.InstanceMachineConfigArgs;
import com.pulumi.gcp.alloydb.Backup;
import com.pulumi.gcp.alloydb.BackupArgs;
import com.pulumi.gcp.alloydb.inputs.ClusterRestoreBackupSourceArgs;
import com.pulumi.gcp.alloydb.inputs.ClusterRestoreContinuousBackupSourceArgs;
import com.pulumi.gcp.organizations.OrganizationsFunctions;
import com.pulumi.gcp.organizations.inputs.GetProjectArgs;
import com.pulumi.resources.CustomResourceOptions;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var default = ComputeFunctions.getNetwork(GetNetworkArgs.builder()
.name("alloydb-network")
.build());
var sourceCluster = new Cluster("sourceCluster", ClusterArgs.builder()
.clusterId("alloydb-source-cluster")
.location("us-central1")
.network(default_.id())
.initialUser(ClusterInitialUserArgs.builder()
.password("alloydb-source-cluster")
.build())
.build());
var privateIpAlloc = new GlobalAddress("privateIpAlloc", GlobalAddressArgs.builder()
.addressType("INTERNAL")
.purpose("VPC_PEERING")
.prefixLength(16)
.network(default_.id())
.build());
var vpcConnection = new Connection("vpcConnection", ConnectionArgs.builder()
.network(default_.id())
.service("servicenetworking.googleapis.com")
.reservedPeeringRanges(privateIpAlloc.name())
.build());
var sourceInstance = new Instance("sourceInstance", InstanceArgs.builder()
.cluster(sourceCluster.name())
.instanceId("alloydb-instance")
.instanceType("PRIMARY")
.machineConfig(InstanceMachineConfigArgs.builder()
.cpuCount(2)
.build())
.build(), CustomResourceOptions.builder()
.dependsOn(vpcConnection)
.build());
var sourceBackup = new Backup("sourceBackup", BackupArgs.builder()
.backupId("alloydb-backup")
.location("us-central1")
.clusterName(sourceCluster.name())
.build(), CustomResourceOptions.builder()
.dependsOn(sourceInstance)
.build());
var restoredFromBackup = new Cluster("restoredFromBackup", ClusterArgs.builder()
.clusterId("alloydb-backup-restored")
.location("us-central1")
.network(default_.id())
.restoreBackupSource(ClusterRestoreBackupSourceArgs.builder()
.backupName(sourceBackup.name())
.build())
.build());
var restoredViaPitr = new Cluster("restoredViaPitr", ClusterArgs.builder()
.clusterId("alloydb-pitr-restored")
.location("us-central1")
.network(default_.id())
.restoreContinuousBackupSource(ClusterRestoreContinuousBackupSourceArgs.builder()
.cluster(sourceCluster.name())
.pointInTime("2023-08-03T19:19:00.094Z")
.build())
.build());
final var project = OrganizationsFunctions.getProject();
}
}

Alloydb Secondary Cluster Basic

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.compute.Network;
import com.pulumi.gcp.alloydb.Cluster;
import com.pulumi.gcp.alloydb.ClusterArgs;
import com.pulumi.gcp.compute.GlobalAddress;
import com.pulumi.gcp.compute.GlobalAddressArgs;
import com.pulumi.gcp.servicenetworking.Connection;
import com.pulumi.gcp.servicenetworking.ConnectionArgs;
import com.pulumi.gcp.alloydb.Instance;
import com.pulumi.gcp.alloydb.InstanceArgs;
import com.pulumi.gcp.alloydb.inputs.InstanceMachineConfigArgs;
import com.pulumi.gcp.alloydb.inputs.ClusterContinuousBackupConfigArgs;
import com.pulumi.gcp.alloydb.inputs.ClusterSecondaryConfigArgs;
import com.pulumi.gcp.organizations.OrganizationsFunctions;
import com.pulumi.gcp.organizations.inputs.GetProjectArgs;
import com.pulumi.resources.CustomResourceOptions;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var default_ = new Network("default");
var primaryCluster = new Cluster("primaryCluster", ClusterArgs.builder()
.clusterId("alloydb-primary-cluster")
.location("us-central1")
.network(default_.id())
.build());
var privateIpAlloc = new GlobalAddress("privateIpAlloc", GlobalAddressArgs.builder()
.addressType("INTERNAL")
.purpose("VPC_PEERING")
.prefixLength(16)
.network(default_.id())
.build());
var vpcConnection = new Connection("vpcConnection", ConnectionArgs.builder()
.network(default_.id())
.service("servicenetworking.googleapis.com")
.reservedPeeringRanges(privateIpAlloc.name())
.build());
var primaryInstance = new Instance("primaryInstance", InstanceArgs.builder()
.cluster(primaryCluster.name())
.instanceId("alloydb-primary-instance")
.instanceType("PRIMARY")
.machineConfig(InstanceMachineConfigArgs.builder()
.cpuCount(2)
.build())
.build(), CustomResourceOptions.builder()
.dependsOn(vpcConnection)
.build());
var secondary = new Cluster("secondary", ClusterArgs.builder()
.clusterId("alloydb-secondary-cluster")
.location("us-east1")
.network(default_.id())
.clusterType("SECONDARY")
.continuousBackupConfig(ClusterContinuousBackupConfigArgs.builder()
.enabled(false)
.build())
.secondaryConfig(ClusterSecondaryConfigArgs.builder()
.primaryClusterName(primaryCluster.name())
.build())
.build(), CustomResourceOptions.builder()
.dependsOn(primaryInstance)
.build());
final var project = OrganizationsFunctions.getProject();
}
}

Import

Cluster can be imported using any of these accepted formats* projects/{{project}}/locations/{{location}}/clusters/{{cluster_id}} * {{project}}/{{location}}/{{cluster_id}} * {{location}}/{{cluster_id}} * {{cluster_id}} In Terraform v1.5.0 and later, use an import block to import Cluster using one of the formats above. For exampletf import { id = "projects/{{project}}/locations/{{location}}/clusters/{{cluster_id}}" to = google_alloydb_cluster.default }

$ pulumi import gcp:alloydb/cluster:Cluster When using the [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import), Cluster can be imported using one of the formats above. For example
$ pulumi import gcp:alloydb/cluster:Cluster default projects/{{project}}/locations/{{location}}/clusters/{{cluster_id}}
$ pulumi import gcp:alloydb/cluster:Cluster default {{project}}/{{location}}/{{cluster_id}}
$ pulumi import gcp:alloydb/cluster:Cluster default {{location}}/{{cluster_id}}
$ pulumi import gcp:alloydb/cluster:Cluster default {{cluster_id}}

Properties

Link copied to clipboard
val annotations: Output<Map<String, String>>?

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.

Link copied to clipboard

The automated backup policy for this cluster. AutomatedBackupPolicy is disabled by default. Structure is documented below.

Link copied to clipboard

Cluster created from backup. Structure is documented below.

Link copied to clipboard
val clusterId: Output<String>

The ID of the alloydb cluster.

Link copied to clipboard
val clusterType: Output<String>?

The type of cluster. If not set, defaults to PRIMARY. Default value is PRIMARY. Possible values are: PRIMARY, SECONDARY.

Link copied to clipboard

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. Structure is documented below.

Link copied to clipboard

ContinuousBackupInfo describes the continuous backup properties of a cluster. Structure is documented below.

Link copied to clipboard
val databaseVersion: Output<String>

The database engine major version. This is an output-only field and it's populated at the Cluster creation time. This field cannot be changed after cluster creation.

Link copied to clipboard
val deletionPolicy: Output<String>?

Policy to determine if the cluster should be deleted forcefully. Deleting a cluster forcefully, deletes the cluster and all its associated instances within the cluster. Deleting a Secondary cluster with a secondary instance REQUIRES setting deletion_policy = "FORCE" otherwise an error is returned. This is needed as there is no support to delete just the secondary instance, and the only way to delete secondary instance is to delete the associated secondary cluster forcefully which also deletes the secondary instance.

Link copied to clipboard
val displayName: Output<String>?

User-settable and human-readable display name for the Cluster.

Link copied to clipboard

All of annotations (key/value pairs) present on the resource in GCP, including the annotations configured through Terraform, other clients and services.

Link copied to clipboard

All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.

Link copied to clipboard

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.

Link copied to clipboard

(Output) Output only. The encryption information for the WALs and backups required for ContinuousBackup. Structure is documented below.

Link copied to clipboard
val etag: Output<String>?

For Resource freshness validation (https://google.aip.dev/154)

Link copied to clipboard
val id: Output<String>
Link copied to clipboard

Initial user to setup during cluster creation. Structure is documented below.

Link copied to clipboard
val labels: Output<Map<String, String>>?

User-defined labels for the alloydb cluster. 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.

Link copied to clipboard
val location: Output<String>

The location where the alloydb cluster should reside.

Link copied to clipboard

Cluster created via DMS migration. Structure is documented below.

Link copied to clipboard
val name: Output<String>

The name of the cluster resource.

Link copied to clipboard
val network: Output<String>

(Optional, Deprecated) The relative resource name of the VPC network on which the instance can be accessed. It is specified in the following form: "projects/{projectNumber}/global/networks/{network_id}".

Link copied to clipboard

Metadata related to network configuration. Structure is documented below.

Link copied to clipboard
val project: Output<String>

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
val pulumiLabels: Output<Map<String, String>>

The combination of labels configured directly on the resource and default labels configured on the provider.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val reconciling: Output<Boolean>

Output only. Reconciling (https://google.aip.dev/128#reconciliation). Set to true if the current state of Cluster does not match the user's intended state, and the service is actively updating the resource to reconcile them. This can happen due to user-triggered updates or system actions like failover or maintenance.

Link copied to clipboard

The source when restoring from a backup. Conflicts with 'restore_continuous_backup_source', both can't be set together. Structure is documented below.

Link copied to clipboard

The source when restoring via point in time recovery (PITR). Conflicts with 'restore_backup_source', both can't be set together. Structure is documented below.

Link copied to clipboard

Configuration of the secondary cluster for Cross Region Replication. This should be set if and only if the cluster is of type SECONDARY. Structure is documented below.

Link copied to clipboard
val state: Output<String>

Output only. The current serving state of the cluster.

Link copied to clipboard
val uid: Output<String>

The system-generated UID of the resource.

Link copied to clipboard
val urn: Output<String>