ClusterArgs

data class ClusterArgs(val annotations: Output<Map<String, String>>? = null, val automatedBackupPolicy: Output<ClusterAutomatedBackupPolicyArgs>? = null, val clusterId: Output<String>? = null, val clusterType: Output<String>? = null, val continuousBackupConfig: Output<ClusterContinuousBackupConfigArgs>? = null, val deletionPolicy: Output<String>? = null, val displayName: Output<String>? = null, val encryptionConfig: Output<ClusterEncryptionConfigArgs>? = null, val etag: Output<String>? = null, val initialUser: Output<ClusterInitialUserArgs>? = null, val labels: Output<Map<String, String>>? = null, val location: Output<String>? = null, val network: Output<String>? = null, val networkConfig: Output<ClusterNetworkConfigArgs>? = null, val project: Output<String>? = null, val restoreBackupSource: Output<ClusterRestoreBackupSourceArgs>? = null, val restoreContinuousBackupSource: Output<ClusterRestoreContinuousBackupSourceArgs>? = null, val secondaryConfig: Output<ClusterSecondaryConfigArgs>? = null) : ConvertibleToJava<ClusterArgs>

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

Constructors

Link copied to clipboard
fun ClusterArgs(annotations: Output<Map<String, String>>? = null, automatedBackupPolicy: Output<ClusterAutomatedBackupPolicyArgs>? = null, clusterId: Output<String>? = null, clusterType: Output<String>? = null, continuousBackupConfig: Output<ClusterContinuousBackupConfigArgs>? = null, deletionPolicy: Output<String>? = null, displayName: Output<String>? = null, encryptionConfig: Output<ClusterEncryptionConfigArgs>? = null, etag: Output<String>? = null, initialUser: Output<ClusterInitialUserArgs>? = null, labels: Output<Map<String, String>>? = null, location: Output<String>? = null, network: Output<String>? = null, networkConfig: Output<ClusterNetworkConfigArgs>? = null, project: Output<String>? = null, restoreBackupSource: Output<ClusterRestoreBackupSourceArgs>? = null, restoreContinuousBackupSource: Output<ClusterRestoreContinuousBackupSourceArgs>? = null, secondaryConfig: Output<ClusterSecondaryConfigArgs>? = null)

Functions

Link copied to clipboard
open override fun toJava(): ClusterArgs

Properties

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

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
val clusterId: Output<String>? = null

The ID of the alloydb cluster.

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

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
val deletionPolicy: Output<String>? = null

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>? = null

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

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
val etag: Output<String>? = null

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

Link copied to clipboard
val initialUser: Output<ClusterInitialUserArgs>? = null

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

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

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>? = null

The location where the alloydb cluster should reside.

Link copied to clipboard
val network: Output<String>? = null

(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>? = null

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

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.