ClusterArgs

data class ClusterArgs(val automatedBackupPolicy: Output<ClusterAutomatedBackupPolicyArgs>? = null, val clusterId: Output<String>? = null, val continuousBackupConfig: Output<ClusterContinuousBackupConfigArgs>? = null, val displayName: Output<String>? = null, val encryptionConfig: Output<ClusterEncryptionConfigArgs>? = 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) : ConvertibleToJava<ClusterArgs>

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

Warning: All arguments including the following potentially sensitive values will be stored in the raw state as plain text: initial_user.password. Read more about sensitive data in state.

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();
}
}

Import

Cluster can be imported using any of these accepted formats

$ 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
constructor(automatedBackupPolicy: Output<ClusterAutomatedBackupPolicyArgs>? = null, clusterId: Output<String>? = null, continuousBackupConfig: Output<ClusterContinuousBackupConfigArgs>? = null, displayName: Output<String>? = null, encryptionConfig: Output<ClusterEncryptionConfigArgs>? = 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)

Properties

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

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

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.

Functions

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