Cluster class

A managed alloydb cluster.

To get more information about Cluster, see:

> Note: Users can promote a secondary cluster to a primary cluster with the help of clusterType. To promote, users have to set the clusterType property as PRIMARY and remove the secondaryConfig field from cluster configuration. See Example.

Switchover is supported in terraform by refreshing the state of the terraform configurations. The switchover operation still needs to be called outside of terraform. After the switchover operation is completed successfully:

  1. Refresh the state of the AlloyDB resources by running pulumi up -refresh-only --auto-approve .
  2. Manually update the terraform configuration file(s) to match the actual state of the resources by modifying the clusterType and secondaryConfig fields.
  3. Verify the sync of terraform state by running pulumi preview and ensure that the infrastructure matches the configuration and no changes are required.

> Note: All arguments marked as write-only values will not be stored in the state: initial_user.password_wo. Read more about Write-only Arguments.

Example Usage

Alloydb Cluster Basic

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const defaultNetwork = new gcp.compute.Network("default", {name: "alloydb-cluster"});
const _default = new gcp.alloydb.Cluster("default", {
    clusterId: "alloydb-cluster",
    location: "us-central1",
    networkConfig: {
        network: defaultNetwork.id,
    },
    deletionProtection: false,
});
const project = gcp.organizations.getProject({});
import pulumi
import pulumi_gcp as gcp

default_network = gcp.compute.Network("default", name="alloydb-cluster")
default = gcp.alloydb.Cluster("default",
    cluster_id="alloydb-cluster",
    location="us-central1",
    network_config={
        "network": default_network.id,
    },
    deletion_protection=False)
project = gcp.organizations.get_project()
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() =>
{
    var defaultNetwork = new Gcp.Compute.Network("default", new()
    {
        Name = "alloydb-cluster",
    });

    var @default = new Gcp.Alloydb.Cluster("default", new()
    {
        ClusterId = "alloydb-cluster",
        Location = "us-central1",
        NetworkConfig = new Gcp.Alloydb.Inputs.ClusterNetworkConfigArgs
        {
            Network = defaultNetwork.Id,
        },
        DeletionProtection = false,
    });

    var project = Gcp.Organizations.GetProject.Invoke();

});
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/alloydb"
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/compute"
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/organizations"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		defaultNetwork, err := compute.NewNetwork(ctx, "default", &compute.NetworkArgs{
			Name: pulumi.String("alloydb-cluster"),
		})
		if err != nil {
			return err
		}
		_, err = alloydb.NewCluster(ctx, "default", &alloydb.ClusterArgs{
			ClusterId: pulumi.String("alloydb-cluster"),
			Location:  pulumi.String("us-central1"),
			NetworkConfig: &alloydb.ClusterNetworkConfigArgs{
				Network: defaultNetwork.ID().ToIDOutput().ToStringOutput(),
			},
			DeletionProtection: pulumi.Bool(false),
		})
		if err != nil {
			return err
		}
		_, err = organizations.LookupProject(ctx, &organizations.LookupProjectArgs{}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    gcp = {
      source = "pulumi/gcp"
    }
  }
}

data "gcp_organizations_getproject" "project" {
}

resource "gcp_alloydb_cluster" "default" {
  cluster_id = "alloydb-cluster"
  location   = "us-central1"
  network_config = {
    network = gcp_compute_network.default.id
  }
  deletion_protection = false
}
resource "gcp_compute_network" "default" {
  name = "alloydb-cluster"
}
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.compute.NetworkArgs;
import com.pulumi.gcp.alloydb.Cluster;
import com.pulumi.gcp.alloydb.ClusterArgs;
import com.pulumi.gcp.alloydb.inputs.ClusterNetworkConfigArgs;
import com.pulumi.gcp.organizations.OrganizationsFunctions;
import com.pulumi.gcp.organizations.inputs.GetProjectArgs;
import java.util.ArrayList;
import java.util.Arrays;
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", NetworkArgs.builder()
            .name("alloydb-cluster")
            .build());

        var default_ = new Cluster("default", ClusterArgs.builder()
            .clusterId("alloydb-cluster")
            .location("us-central1")
            .networkConfig(ClusterNetworkConfigArgs.builder()
                .network(defaultNetwork.id())
                .build())
            .deletionProtection(false)
            .build());

        final var project = OrganizationsFunctions.getProject(GetProjectArgs.builder()
            .build());

    }
}
resources:
  default:
    type: gcp:alloydb:Cluster
    properties:
      clusterId: alloydb-cluster
      location: us-central1
      networkConfig:
        network: ${defaultNetwork.id}
      deletionProtection: false
  defaultNetwork:
    type: gcp:compute:Network
    name: default
    properties:
      name: alloydb-cluster
variables:
  project:
    fn::invoke:
      function: gcp:organizations:getProject
      arguments: {}

Alloydb Cluster Before Upgrade

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const _default = gcp.compute.getNetwork({
    name: "alloydb-network",
});
const defaultCluster = new gcp.alloydb.Cluster("default", {
    clusterId: "alloydb-cluster",
    location: "us-central1",
    networkConfig: {
        network: _default.then(_default => _default.id),
    },
    databaseVersion: "POSTGRES_14",
    initialUser: {
        password: "alloydb-cluster",
    },
    deletionProtection: false,
});
const defaultInstance = new gcp.alloydb.Instance("default", {
    cluster: defaultCluster.name,
    instanceId: "alloydb-instance",
    instanceType: "PRIMARY",
    machineConfig: {
        cpuCount: 2,
    },
});
import pulumi
import pulumi_gcp as gcp

default = gcp.compute.get_network(name="alloydb-network")
default_cluster = gcp.alloydb.Cluster("default",
    cluster_id="alloydb-cluster",
    location="us-central1",
    network_config={
        "network": default.id,
    },
    database_version="POSTGRES_14",
    initial_user={
        "password": "alloydb-cluster",
    },
    deletion_protection=False)
default_instance = gcp.alloydb.Instance("default",
    cluster=default_cluster.name,
    instance_id="alloydb-instance",
    instance_type="PRIMARY",
    machine_config={
        "cpu_count": 2,
    })
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() =>
{
    var @default = Gcp.Compute.GetNetwork.Invoke(new()
    {
        Name = "alloydb-network",
    });

    var defaultCluster = new Gcp.Alloydb.Cluster("default", new()
    {
        ClusterId = "alloydb-cluster",
        Location = "us-central1",
        NetworkConfig = new Gcp.Alloydb.Inputs.ClusterNetworkConfigArgs
        {
            Network = @default.Apply(@default => @default.Apply(getNetworkResult => getNetworkResult.Id)),
        },
        DatabaseVersion = "POSTGRES_14",
        InitialUser = new Gcp.Alloydb.Inputs.ClusterInitialUserArgs
        {
            Password = "alloydb-cluster",
        },
        DeletionProtection = false,
    });

    var defaultInstance = new Gcp.Alloydb.Instance("default", new()
    {
        Cluster = defaultCluster.Name,
        InstanceId = "alloydb-instance",
        InstanceType = "PRIMARY",
        MachineConfig = new Gcp.Alloydb.Inputs.InstanceMachineConfigArgs
        {
            CpuCount = 2,
        },
    });

});
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/alloydb"
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/compute"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_default, err := compute.LookupNetwork(ctx, &compute.LookupNetworkArgs{
			Name: pulumi.StringRef("alloydb-network"),
		}, nil)
		if err != nil {
			return err
		}
		defaultCluster, err := alloydb.NewCluster(ctx, "default", &alloydb.ClusterArgs{
			ClusterId: pulumi.String("alloydb-cluster"),
			Location:  pulumi.String("us-central1"),
			NetworkConfig: &alloydb.ClusterNetworkConfigArgs{
				Network: pulumi.String(_default.Id),
			},
			DatabaseVersion: pulumi.String("POSTGRES_14"),
			InitialUser: &alloydb.ClusterInitialUserArgs{
				Password: pulumi.String("alloydb-cluster"),
			},
			DeletionProtection: pulumi.Bool(false),
		})
		if err != nil {
			return err
		}
		_, err = alloydb.NewInstance(ctx, "default", &alloydb.InstanceArgs{
			Cluster:      defaultCluster.Name,
			InstanceId:   pulumi.String("alloydb-instance"),
			InstanceType: pulumi.String("PRIMARY"),
			MachineConfig: &alloydb.InstanceMachineConfigArgs{
				CpuCount: pulumi.Int(2),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    gcp = {
      source = "pulumi/gcp"
    }
  }
}

data "gcp_compute_getnetwork" "default" {
  name = "alloydb-network"
}

resource "gcp_alloydb_instance" "default" {
  cluster       = gcp_alloydb_cluster.default.name
  instance_id   = "alloydb-instance"
  instance_type = "PRIMARY"
  machine_config = {
    cpu_count = 2
  }
}
resource "gcp_alloydb_cluster" "default" {
  cluster_id = "alloydb-cluster"
  location   = "us-central1"
  network_config = {
    network = data.gcp_compute_getnetwork.default.id
  }
  database_version = "POSTGRES_14"
  initial_user = {
    password = "alloydb-cluster"
  }
  deletion_protection = false
}
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.ClusterNetworkConfigArgs;
import com.pulumi.gcp.alloydb.inputs.ClusterInitialUserArgs;
import com.pulumi.gcp.alloydb.Instance;
import com.pulumi.gcp.alloydb.InstanceArgs;
import com.pulumi.gcp.alloydb.inputs.InstanceMachineConfigArgs;
import java.util.ArrayList;
import java.util.Arrays;
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 defaultCluster = new Cluster("defaultCluster", ClusterArgs.builder()
            .clusterId("alloydb-cluster")
            .location("us-central1")
            .networkConfig(ClusterNetworkConfigArgs.builder()
                .network(default_.id())
                .build())
            .databaseVersion("POSTGRES_14")
            .initialUser(ClusterInitialUserArgs.builder()
                .password("alloydb-cluster")
                .build())
            .deletionProtection(false)
            .build());

        var defaultInstance = new Instance("defaultInstance", InstanceArgs.builder()
            .cluster(defaultCluster.name())
            .instanceId("alloydb-instance")
            .instanceType("PRIMARY")
            .machineConfig(InstanceMachineConfigArgs.builder()
                .cpuCount(2)
                .build())
            .build());

    }
}
resources:
  defaultInstance:
    type: gcp:alloydb:Instance
    name: default
    properties:
      cluster: ${defaultCluster.name}
      instanceId: alloydb-instance
      instanceType: PRIMARY
      machineConfig:
        cpuCount: 2
  defaultCluster:
    type: gcp:alloydb:Cluster
    name: default
    properties:
      clusterId: alloydb-cluster
      location: us-central1
      networkConfig:
        network: ${default.id}
      databaseVersion: POSTGRES_14
      initialUser:
        password: alloydb-cluster
      deletionProtection: false
variables:
  default:
    fn::invoke:
      function: gcp:compute:getNetwork
      arguments:
        name: alloydb-network

Alloydb Cluster After Upgrade

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const _default = gcp.compute.getNetwork({
    name: "alloydb-network",
});
const defaultCluster = new gcp.alloydb.Cluster("default", {
    clusterId: "alloydb-cluster",
    location: "us-central1",
    networkConfig: {
        network: _default.then(_default => _default.id),
    },
    databaseVersion: "POSTGRES_15",
    initialUser: {
        password: "alloydb-cluster",
    },
    deletionProtection: false,
});
const defaultInstance = new gcp.alloydb.Instance("default", {
    cluster: defaultCluster.name,
    instanceId: "alloydb-instance",
    instanceType: "PRIMARY",
    machineConfig: {
        cpuCount: 2,
    },
});
import pulumi
import pulumi_gcp as gcp

default = gcp.compute.get_network(name="alloydb-network")
default_cluster = gcp.alloydb.Cluster("default",
    cluster_id="alloydb-cluster",
    location="us-central1",
    network_config={
        "network": default.id,
    },
    database_version="POSTGRES_15",
    initial_user={
        "password": "alloydb-cluster",
    },
    deletion_protection=False)
default_instance = gcp.alloydb.Instance("default",
    cluster=default_cluster.name,
    instance_id="alloydb-instance",
    instance_type="PRIMARY",
    machine_config={
        "cpu_count": 2,
    })
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() =>
{
    var @default = Gcp.Compute.GetNetwork.Invoke(new()
    {
        Name = "alloydb-network",
    });

    var defaultCluster = new Gcp.Alloydb.Cluster("default", new()
    {
        ClusterId = "alloydb-cluster",
        Location = "us-central1",
        NetworkConfig = new Gcp.Alloydb.Inputs.ClusterNetworkConfigArgs
        {
            Network = @default.Apply(@default => @default.Apply(getNetworkResult => getNetworkResult.Id)),
        },
        DatabaseVersion = "POSTGRES_15",
        InitialUser = new Gcp.Alloydb.Inputs.ClusterInitialUserArgs
        {
            Password = "alloydb-cluster",
        },
        DeletionProtection = false,
    });

    var defaultInstance = new Gcp.Alloydb.Instance("default", new()
    {
        Cluster = defaultCluster.Name,
        InstanceId = "alloydb-instance",
        InstanceType = "PRIMARY",
        MachineConfig = new Gcp.Alloydb.Inputs.InstanceMachineConfigArgs
        {
            CpuCount = 2,
        },
    });

});
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/alloydb"
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/compute"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_default, err := compute.LookupNetwork(ctx, &compute.LookupNetworkArgs{
			Name: pulumi.StringRef("alloydb-network"),
		}, nil)
		if err != nil {
			return err
		}
		defaultCluster, err := alloydb.NewCluster(ctx, "default", &alloydb.ClusterArgs{
			ClusterId: pulumi.String("alloydb-cluster"),
			Location:  pulumi.String("us-central1"),
			NetworkConfig: &alloydb.ClusterNetworkConfigArgs{
				Network: pulumi.String(_default.Id),
			},
			DatabaseVersion: pulumi.String("POSTGRES_15"),
			InitialUser: &alloydb.ClusterInitialUserArgs{
				Password: pulumi.String("alloydb-cluster"),
			},
			DeletionProtection: pulumi.Bool(false),
		})
		if err != nil {
			return err
		}
		_, err = alloydb.NewInstance(ctx, "default", &alloydb.InstanceArgs{
			Cluster:      defaultCluster.Name,
			InstanceId:   pulumi.String("alloydb-instance"),
			InstanceType: pulumi.String("PRIMARY"),
			MachineConfig: &alloydb.InstanceMachineConfigArgs{
				CpuCount: pulumi.Int(2),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    gcp = {
      source = "pulumi/gcp"
    }
  }
}

data "gcp_compute_getnetwork" "default" {
  name = "alloydb-network"
}

resource "gcp_alloydb_instance" "default" {
  cluster       = gcp_alloydb_cluster.default.name
  instance_id   = "alloydb-instance"
  instance_type = "PRIMARY"
  machine_config = {
    cpu_count = 2
  }
}
resource "gcp_alloydb_cluster" "default" {
  cluster_id = "alloydb-cluster"
  location   = "us-central1"
  network_config = {
    network = data.gcp_compute_getnetwork.default.id
  }
  database_version = "POSTGRES_15"
  initial_user = {
    password = "alloydb-cluster"
  }
  deletion_protection = false
}
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.ClusterNetworkConfigArgs;
import com.pulumi.gcp.alloydb.inputs.ClusterInitialUserArgs;
import com.pulumi.gcp.alloydb.Instance;
import com.pulumi.gcp.alloydb.InstanceArgs;
import com.pulumi.gcp.alloydb.inputs.InstanceMachineConfigArgs;
import java.util.ArrayList;
import java.util.Arrays;
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 defaultCluster = new Cluster("defaultCluster", ClusterArgs.builder()
            .clusterId("alloydb-cluster")
            .location("us-central1")
            .networkConfig(ClusterNetworkConfigArgs.builder()
                .network(default_.id())
                .build())
            .databaseVersion("POSTGRES_15")
            .initialUser(ClusterInitialUserArgs.builder()
                .password("alloydb-cluster")
                .build())
            .deletionProtection(false)
            .build());

        var defaultInstance = new Instance("defaultInstance", InstanceArgs.builder()
            .cluster(defaultCluster.name())
            .instanceId("alloydb-instance")
            .instanceType("PRIMARY")
            .machineConfig(InstanceMachineConfigArgs.builder()
                .cpuCount(2)
                .build())
            .build());

    }
}
resources:
  defaultInstance:
    type: gcp:alloydb:Instance
    name: default
    properties:
      cluster: ${defaultCluster.name}
      instanceId: alloydb-instance
      instanceType: PRIMARY
      machineConfig:
        cpuCount: 2
  defaultCluster:
    type: gcp:alloydb:Cluster
    name: default
    properties:
      clusterId: alloydb-cluster
      location: us-central1
      networkConfig:
        network: ${default.id}
      databaseVersion: POSTGRES_15
      initialUser:
        password: alloydb-cluster
      deletionProtection: false
variables:
  default:
    fn::invoke:
      function: gcp:compute:getNetwork
      arguments:
        name: alloydb-network

Alloydb Cluster Full

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const _default = new gcp.compute.Network("default", {name: "alloydb-cluster-full"});
const full = new gcp.alloydb.Cluster("full", {
    clusterId: "alloydb-cluster-full",
    location: "us-central1",
    networkConfig: {
        network: _default.id,
    },
    databaseVersion: "POSTGRES_15",
    initialUser: {
        user: "alloydb-cluster-full",
        password: "alloydb-cluster-full",
    },
    continuousBackupConfig: {
        enabled: true,
        recoveryWindowDays: 14,
    },
    automatedBackupPolicy: {
        location: "us-central1",
        backupWindow: "1800s",
        enabled: true,
        weeklySchedule: {
            daysOfWeeks: ["MONDAY"],
            startTimes: [{
                hours: 23,
                minutes: 0,
                seconds: 0,
                nanos: 0,
            }],
        },
        quantityBasedRetention: {
            count: 1,
        },
        labels: {
            test: "alloydb-cluster-full",
        },
    },
    labels: {
        test: "alloydb-cluster-full",
    },
    deletionProtection: false,
});
const project = gcp.organizations.getProject({});
import pulumi
import pulumi_gcp as gcp

default = gcp.compute.Network("default", name="alloydb-cluster-full")
full = gcp.alloydb.Cluster("full",
    cluster_id="alloydb-cluster-full",
    location="us-central1",
    network_config={
        "network": default.id,
    },
    database_version="POSTGRES_15",
    initial_user={
        "user": "alloydb-cluster-full",
        "password": "alloydb-cluster-full",
    },
    continuous_backup_config={
        "enabled": True,
        "recovery_window_days": 14,
    },
    automated_backup_policy={
        "location": "us-central1",
        "backup_window": "1800s",
        "enabled": True,
        "weekly_schedule": {
            "days_of_weeks": ["MONDAY"],
            "start_times": [{
                "hours": 23,
                "minutes": 0,
                "seconds": 0,
                "nanos": 0,
            }],
        },
        "quantity_based_retention": {
            "count": 1,
        },
        "labels": {
            "test": "alloydb-cluster-full",
        },
    },
    labels={
        "test": "alloydb-cluster-full",
    },
    deletion_protection=False)
project = gcp.organizations.get_project()
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() =>
{
    var @default = new Gcp.Compute.Network("default", new()
    {
        Name = "alloydb-cluster-full",
    });

    var full = new Gcp.Alloydb.Cluster("full", new()
    {
        ClusterId = "alloydb-cluster-full",
        Location = "us-central1",
        NetworkConfig = new Gcp.Alloydb.Inputs.ClusterNetworkConfigArgs
        {
            Network = @default.Id,
        },
        DatabaseVersion = "POSTGRES_15",
        InitialUser = new Gcp.Alloydb.Inputs.ClusterInitialUserArgs
        {
            User = "alloydb-cluster-full",
            Password = "alloydb-cluster-full",
        },
        ContinuousBackupConfig = new Gcp.Alloydb.Inputs.ClusterContinuousBackupConfigArgs
        {
            Enabled = true,
            RecoveryWindowDays = 14,
        },
        AutomatedBackupPolicy = new Gcp.Alloydb.Inputs.ClusterAutomatedBackupPolicyArgs
        {
            Location = "us-central1",
            BackupWindow = "1800s",
            Enabled = true,
            WeeklySchedule = new Gcp.Alloydb.Inputs.ClusterAutomatedBackupPolicyWeeklyScheduleArgs
            {
                DaysOfWeeks = new[]
                {
                    "MONDAY",
                },
                StartTimes = new[]
                {
                    new Gcp.Alloydb.Inputs.ClusterAutomatedBackupPolicyWeeklyScheduleStartTimeArgs
                    {
                        Hours = 23,
                        Minutes = 0,
                        Seconds = 0,
                        Nanos = 0,
                    },
                },
            },
            QuantityBasedRetention = new Gcp.Alloydb.Inputs.ClusterAutomatedBackupPolicyQuantityBasedRetentionArgs
            {
                Count = 1,
            },
            Labels =
            {
                { "test", "alloydb-cluster-full" },
            },
        },
        Labels =
        {
            { "test", "alloydb-cluster-full" },
        },
        DeletionProtection = false,
    });

    var project = Gcp.Organizations.GetProject.Invoke();

});
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/alloydb"
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/compute"
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/organizations"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_default, err := compute.NewNetwork(ctx, "default", &compute.NetworkArgs{
			Name: pulumi.String("alloydb-cluster-full"),
		})
		if err != nil {
			return err
		}
		_, err = alloydb.NewCluster(ctx, "full", &alloydb.ClusterArgs{
			ClusterId: pulumi.String("alloydb-cluster-full"),
			Location:  pulumi.String("us-central1"),
			NetworkConfig: &alloydb.ClusterNetworkConfigArgs{
				Network: _default.ID().ToIDOutput().ToStringOutput(),
			},
			DatabaseVersion: pulumi.String("POSTGRES_15"),
			InitialUser: &alloydb.ClusterInitialUserArgs{
				User:     pulumi.String("alloydb-cluster-full"),
				Password: pulumi.String("alloydb-cluster-full"),
			},
			ContinuousBackupConfig: &alloydb.ClusterContinuousBackupConfigArgs{
				Enabled:            pulumi.Bool(true),
				RecoveryWindowDays: pulumi.Int(14),
			},
			AutomatedBackupPolicy: &alloydb.ClusterAutomatedBackupPolicyArgs{
				Location:     pulumi.String("us-central1"),
				BackupWindow: pulumi.String("1800s"),
				Enabled:      pulumi.Bool(true),
				WeeklySchedule: &alloydb.ClusterAutomatedBackupPolicyWeeklyScheduleArgs{
					DaysOfWeeks: pulumi.StringArray{
						pulumi.String("MONDAY"),
					},
					StartTimes: alloydb.ClusterAutomatedBackupPolicyWeeklyScheduleStartTimeArray{
						&alloydb.ClusterAutomatedBackupPolicyWeeklyScheduleStartTimeArgs{
							Hours:   pulumi.Int(23),
							Minutes: pulumi.Int(0),
							Seconds: pulumi.Int(0),
							Nanos:   pulumi.Int(0),
						},
					},
				},
				QuantityBasedRetention: &alloydb.ClusterAutomatedBackupPolicyQuantityBasedRetentionArgs{
					Count: pulumi.Int(1),
				},
				Labels: pulumi.StringMap{
					"test": pulumi.String("alloydb-cluster-full"),
				},
			},
			Labels: pulumi.StringMap{
				"test": pulumi.String("alloydb-cluster-full"),
			},
			DeletionProtection: pulumi.Bool(false),
		})
		if err != nil {
			return err
		}
		_, err = organizations.LookupProject(ctx, &organizations.LookupProjectArgs{}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    gcp = {
      source = "pulumi/gcp"
    }
  }
}

data "gcp_organizations_getproject" "project" {
}

resource "gcp_alloydb_cluster" "full" {
  cluster_id = "alloydb-cluster-full"
  location   = "us-central1"
  network_config = {
    network = gcp_compute_network.default.id
  }
  database_version = "POSTGRES_15"
  initial_user = {
    user     = "alloydb-cluster-full"
    password = "alloydb-cluster-full"
  }
  continuous_backup_config = {
    enabled              = true
    recovery_window_days = 14
  }
  automated_backup_policy = {
    location      = "us-central1"
    backup_window = "1800s"
    enabled       = true
    weekly_schedule = {
      days_of_weeks = ["MONDAY"]
      start_times = [{
        "hours"   = 23
        "minutes" = 0
        "seconds" = 0
        "nanos"   = 0
      }]
    }
    quantity_based_retention = {
      count = 1
    }
    labels = {
      "test" = "alloydb-cluster-full"
    }
  }
  labels = {
    "test" = "alloydb-cluster-full"
  }
  deletion_protection = false
}
resource "gcp_compute_network" "default" {
  name = "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.compute.NetworkArgs;
import com.pulumi.gcp.alloydb.Cluster;
import com.pulumi.gcp.alloydb.ClusterArgs;
import com.pulumi.gcp.alloydb.inputs.ClusterNetworkConfigArgs;
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.ClusterAutomatedBackupPolicyWeeklyScheduleStartTimeArgs;
import com.pulumi.gcp.alloydb.inputs.ClusterAutomatedBackupPolicyQuantityBasedRetentionArgs;
import com.pulumi.gcp.organizations.OrganizationsFunctions;
import com.pulumi.gcp.organizations.inputs.GetProjectArgs;
import java.util.ArrayList;
import java.util.Arrays;
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", NetworkArgs.builder()
            .name("alloydb-cluster-full")
            .build());

        var full = new Cluster("full", ClusterArgs.builder()
            .clusterId("alloydb-cluster-full")
            .location("us-central1")
            .networkConfig(ClusterNetworkConfigArgs.builder()
                .network(default_.id())
                .build())
            .databaseVersion("POSTGRES_15")
            .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"))
            .deletionProtection(false)
            .build());

        final var project = OrganizationsFunctions.getProject(GetProjectArgs.builder()
            .build());

    }
}
resources:
  full:
    type: gcp:alloydb:Cluster
    properties:
      clusterId: alloydb-cluster-full
      location: us-central1
      networkConfig:
        network: ${default.id}
      databaseVersion: POSTGRES_15
      initialUser:
        user: alloydb-cluster-full
        password: alloydb-cluster-full
      continuousBackupConfig:
        enabled: true
        recoveryWindowDays: 14
      automatedBackupPolicy:
        location: us-central1
        backupWindow: 1800s
        enabled: true
        weeklySchedule:
          daysOfWeeks:
            - MONDAY
          startTimes:
            - hours: 23
              minutes: 0
              seconds: 0
              nanos: 0
        quantityBasedRetention:
          count: 1
        labels:
          test: alloydb-cluster-full
      labels:
        test: alloydb-cluster-full
      deletionProtection: false
  default:
    type: gcp:compute:Network
    properties:
      name: alloydb-cluster-full
variables:
  project:
    fn::invoke:
      function: gcp:organizations:getProject
      arguments: {}

Alloydb Cluster Restore

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const _default = gcp.compute.getNetwork({
    name: "alloydb-network",
});
const source = new gcp.alloydb.Cluster("source", {
    clusterId: "alloydb-source-cluster",
    location: "us-central1",
    network: _default.then(_default => _default.id),
    initialUser: {
        password: "alloydb-source-cluster",
    },
    deletionProtection: false,
});
const privateIpAlloc = new gcp.compute.GlobalAddress("private_ip_alloc", {
    name: "alloydb-source-cluster",
    addressType: "INTERNAL",
    purpose: "VPC_PEERING",
    prefixLength: 16,
    network: _default.then(_default => _default.id),
});
const vpcConnection = new gcp.servicenetworking.Connection("vpc_connection", {
    network: _default.then(_default => _default.id),
    service: "servicenetworking.googleapis.com",
    reservedPeeringRanges: [privateIpAlloc.name],
});
const sourceInstance = new gcp.alloydb.Instance("source", {
    cluster: source.name,
    instanceId: "alloydb-instance",
    instanceType: "PRIMARY",
    machineConfig: {
        cpuCount: 2,
    },
}, {
    dependsOn: [vpcConnection],
});
const sourceBackup = new gcp.alloydb.Backup("source", {
    backupId: "alloydb-backup",
    location: "us-central1",
    clusterName: source.name,
}, {
    dependsOn: [sourceInstance],
});
const restoredFromBackup = new gcp.alloydb.Cluster("restored_from_backup", {
    clusterId: "alloydb-backup-restored",
    location: "us-central1",
    networkConfig: {
        network: _default.then(_default => _default.id),
    },
    restoreBackupSource: {
        backupName: sourceBackup.name,
    },
    deletionProtection: false,
});
const restoredViaPitr = new gcp.alloydb.Cluster("restored_via_pitr", {
    clusterId: "alloydb-pitr-restored",
    location: "us-central1",
    networkConfig: {
        network: _default.then(_default => _default.id),
    },
    restoreContinuousBackupSource: {
        cluster: source.name,
        pointInTime: "2023-08-03T19:19:00.094Z",
    },
    deletionProtection: false,
});
const project = gcp.organizations.getProject({});
import pulumi
import pulumi_gcp as gcp

default = gcp.compute.get_network(name="alloydb-network")
source = gcp.alloydb.Cluster("source",
    cluster_id="alloydb-source-cluster",
    location="us-central1",
    network=default.id,
    initial_user={
        "password": "alloydb-source-cluster",
    },
    deletion_protection=False)
private_ip_alloc = gcp.compute.GlobalAddress("private_ip_alloc",
    name="alloydb-source-cluster",
    address_type="INTERNAL",
    purpose="VPC_PEERING",
    prefix_length=16,
    network=default.id)
vpc_connection = gcp.servicenetworking.Connection("vpc_connection",
    network=default.id,
    service="servicenetworking.googleapis.com",
    reserved_peering_ranges=[private_ip_alloc.name])
source_instance = gcp.alloydb.Instance("source",
    cluster=source.name,
    instance_id="alloydb-instance",
    instance_type="PRIMARY",
    machine_config={
        "cpu_count": 2,
    },
    opts = pulumi.ResourceOptions(depends_on=[vpc_connection]))
source_backup = gcp.alloydb.Backup("source",
    backup_id="alloydb-backup",
    location="us-central1",
    cluster_name=source.name,
    opts = pulumi.ResourceOptions(depends_on=[source_instance]))
restored_from_backup = gcp.alloydb.Cluster("restored_from_backup",
    cluster_id="alloydb-backup-restored",
    location="us-central1",
    network_config={
        "network": default.id,
    },
    restore_backup_source={
        "backup_name": source_backup.name,
    },
    deletion_protection=False)
restored_via_pitr = gcp.alloydb.Cluster("restored_via_pitr",
    cluster_id="alloydb-pitr-restored",
    location="us-central1",
    network_config={
        "network": default.id,
    },
    restore_continuous_backup_source={
        "cluster": source.name,
        "point_in_time": "2023-08-03T19:19:00.094Z",
    },
    deletion_protection=False)
project = gcp.organizations.get_project()
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() =>
{
    var @default = Gcp.Compute.GetNetwork.Invoke(new()
    {
        Name = "alloydb-network",
    });

    var source = new Gcp.Alloydb.Cluster("source", new()
    {
        ClusterId = "alloydb-source-cluster",
        Location = "us-central1",
        Network = @default.Apply(@default => @default.Apply(getNetworkResult => getNetworkResult.Id)),
        InitialUser = new Gcp.Alloydb.Inputs.ClusterInitialUserArgs
        {
            Password = "alloydb-source-cluster",
        },
        DeletionProtection = false,
    });

    var privateIpAlloc = new Gcp.Compute.GlobalAddress("private_ip_alloc", new()
    {
        Name = "alloydb-source-cluster",
        AddressType = "INTERNAL",
        Purpose = "VPC_PEERING",
        PrefixLength = 16,
        Network = @default.Apply(@default => @default.Apply(getNetworkResult => getNetworkResult.Id)),
    });

    var vpcConnection = new Gcp.ServiceNetworking.Connection("vpc_connection", new()
    {
        Network = @default.Apply(@default => @default.Apply(getNetworkResult => getNetworkResult.Id)),
        Service = "servicenetworking.googleapis.com",
        ReservedPeeringRanges = new[]
        {
            privateIpAlloc.Name,
        },
    });

    var sourceInstance = new Gcp.Alloydb.Instance("source", new()
    {
        Cluster = source.Name,
        InstanceId = "alloydb-instance",
        InstanceType = "PRIMARY",
        MachineConfig = new Gcp.Alloydb.Inputs.InstanceMachineConfigArgs
        {
            CpuCount = 2,
        },
    }, new CustomResourceOptions
    {
        DependsOn =
        {
            vpcConnection,
        },
    });

    var sourceBackup = new Gcp.Alloydb.Backup("source", new()
    {
        BackupId = "alloydb-backup",
        Location = "us-central1",
        ClusterName = source.Name,
    }, new CustomResourceOptions
    {
        DependsOn =
        {
            sourceInstance,
        },
    });

    var restoredFromBackup = new Gcp.Alloydb.Cluster("restored_from_backup", new()
    {
        ClusterId = "alloydb-backup-restored",
        Location = "us-central1",
        NetworkConfig = new Gcp.Alloydb.Inputs.ClusterNetworkConfigArgs
        {
            Network = @default.Apply(@default => @default.Apply(getNetworkResult => getNetworkResult.Id)),
        },
        RestoreBackupSource = new Gcp.Alloydb.Inputs.ClusterRestoreBackupSourceArgs
        {
            BackupName = sourceBackup.Name,
        },
        DeletionProtection = false,
    });

    var restoredViaPitr = new Gcp.Alloydb.Cluster("restored_via_pitr", new()
    {
        ClusterId = "alloydb-pitr-restored",
        Location = "us-central1",
        NetworkConfig = new Gcp.Alloydb.Inputs.ClusterNetworkConfigArgs
        {
            Network = @default.Apply(@default => @default.Apply(getNetworkResult => getNetworkResult.Id)),
        },
        RestoreContinuousBackupSource = new Gcp.Alloydb.Inputs.ClusterRestoreContinuousBackupSourceArgs
        {
            Cluster = source.Name,
            PointInTime = "2023-08-03T19:19:00.094Z",
        },
        DeletionProtection = false,
    });

    var project = Gcp.Organizations.GetProject.Invoke();

});
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/alloydb"
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/compute"
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/organizations"
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/servicenetworking"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_default, err := compute.LookupNetwork(ctx, &compute.LookupNetworkArgs{
			Name: pulumi.StringRef("alloydb-network"),
		}, nil)
		if err != nil {
			return err
		}
		source, err := alloydb.NewCluster(ctx, "source", &alloydb.ClusterArgs{
			ClusterId: pulumi.String("alloydb-source-cluster"),
			Location:  pulumi.String("us-central1"),
			Network:   _default.Id,
			InitialUser: &alloydb.ClusterInitialUserArgs{
				Password: pulumi.String("alloydb-source-cluster"),
			},
			DeletionProtection: pulumi.Bool(false),
		})
		if err != nil {
			return err
		}
		privateIpAlloc, err := compute.NewGlobalAddress(ctx, "private_ip_alloc", &compute.GlobalAddressArgs{
			Name:         pulumi.String("alloydb-source-cluster"),
			AddressType:  pulumi.String("INTERNAL"),
			Purpose:      pulumi.String("VPC_PEERING"),
			PrefixLength: pulumi.Int(16),
			Network:      pulumi.String(_default.Id),
		})
		if err != nil {
			return err
		}
		vpcConnection, err := servicenetworking.NewConnection(ctx, "vpc_connection", &servicenetworking.ConnectionArgs{
			Network: pulumi.String(_default.Id),
			Service: pulumi.String("servicenetworking.googleapis.com"),
			ReservedPeeringRanges: pulumi.StringArray{
				privateIpAlloc.Name,
			},
		})
		if err != nil {
			return err
		}
		sourceInstance, err := alloydb.NewInstance(ctx, "source", &alloydb.InstanceArgs{
			Cluster:      source.Name,
			InstanceId:   pulumi.String("alloydb-instance"),
			InstanceType: pulumi.String("PRIMARY"),
			MachineConfig: &alloydb.InstanceMachineConfigArgs{
				CpuCount: pulumi.Int(2),
			},
		}, pulumi.DependsOn([]pulumi.Resource{
			vpcConnection,
		}))
		if err != nil {
			return err
		}
		sourceBackup, err := alloydb.NewBackup(ctx, "source", &alloydb.BackupArgs{
			BackupId:    pulumi.String("alloydb-backup"),
			Location:    pulumi.String("us-central1"),
			ClusterName: source.Name,
		}, pulumi.DependsOn([]pulumi.Resource{
			sourceInstance,
		}))
		if err != nil {
			return err
		}
		_, err = alloydb.NewCluster(ctx, "restored_from_backup", &alloydb.ClusterArgs{
			ClusterId: pulumi.String("alloydb-backup-restored"),
			Location:  pulumi.String("us-central1"),
			NetworkConfig: &alloydb.ClusterNetworkConfigArgs{
				Network: pulumi.String(_default.Id),
			},
			RestoreBackupSource: &alloydb.ClusterRestoreBackupSourceArgs{
				BackupName: sourceBackup.Name,
			},
			DeletionProtection: pulumi.Bool(false),
		})
		if err != nil {
			return err
		}
		_, err = alloydb.NewCluster(ctx, "restored_via_pitr", &alloydb.ClusterArgs{
			ClusterId: pulumi.String("alloydb-pitr-restored"),
			Location:  pulumi.String("us-central1"),
			NetworkConfig: &alloydb.ClusterNetworkConfigArgs{
				Network: pulumi.String(_default.Id),
			},
			RestoreContinuousBackupSource: &alloydb.ClusterRestoreContinuousBackupSourceArgs{
				Cluster:     source.Name,
				PointInTime: pulumi.String("2023-08-03T19:19:00.094Z"),
			},
			DeletionProtection: pulumi.Bool(false),
		})
		if err != nil {
			return err
		}
		_, err = organizations.LookupProject(ctx, &organizations.LookupProjectArgs{}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    gcp = {
      source = "pulumi/gcp"
    }
  }
}

data "gcp_organizations_getproject" "project" {
}
data "gcp_compute_getnetwork" "default" {
  name = "alloydb-network"
}

resource "gcp_alloydb_cluster" "source" {
  cluster_id = "alloydb-source-cluster"
  location   = "us-central1"
  network    = data.gcp_compute_getnetwork.default.id
  initial_user = {
    password = "alloydb-source-cluster"
  }
  deletion_protection = false
}
resource "gcp_alloydb_instance" "source" {
  depends_on    = [gcp_servicenetworking_connection.vpc_connection]
  cluster       = gcp_alloydb_cluster.source.name
  instance_id   = "alloydb-instance"
  instance_type = "PRIMARY"
  machine_config = {
    cpu_count = 2
  }
}
resource "gcp_alloydb_backup" "source" {
  depends_on   = [gcp_alloydb_instance.source]
  backup_id    = "alloydb-backup"
  location     = "us-central1"
  cluster_name = gcp_alloydb_cluster.source.name
}
resource "gcp_alloydb_cluster" "restored_from_backup" {
  cluster_id = "alloydb-backup-restored"
  location   = "us-central1"
  network_config = {
    network = data.gcp_compute_getnetwork.default.id
  }
  restore_backup_source = {
    backup_name = gcp_alloydb_backup.source.name
  }
  deletion_protection = false
}
resource "gcp_alloydb_cluster" "restored_via_pitr" {
  cluster_id = "alloydb-pitr-restored"
  location   = "us-central1"
  network_config = {
    network = data.gcp_compute_getnetwork.default.id
  }
  restore_continuous_backup_source = {
    cluster       = gcp_alloydb_cluster.source.name
    point_in_time = "2023-08-03T19:19:00.094Z"
  }
  deletion_protection = false
}
resource "gcp_compute_globaladdress" "private_ip_alloc" {
  name          = "alloydb-source-cluster"
  address_type  = "INTERNAL"
  purpose       = "VPC_PEERING"
  prefix_length = 16
  network       = data.gcp_compute_getnetwork.default.id
}
resource "gcp_servicenetworking_connection" "vpc_connection" {
  network                 = data.gcp_compute_getnetwork.default.id
  service                 = "servicenetworking.googleapis.com"
  reserved_peering_ranges = [gcp_compute_globaladdress.private_ip_alloc.name]
}
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.ClusterNetworkConfigArgs;
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.ArrayList;
import java.util.Arrays;
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 source = new Cluster("source", ClusterArgs.builder()
            .clusterId("alloydb-source-cluster")
            .location("us-central1")
            .network(default_.id())
            .initialUser(ClusterInitialUserArgs.builder()
                .password("alloydb-source-cluster")
                .build())
            .deletionProtection(false)
            .build());

        var privateIpAlloc = new GlobalAddress("privateIpAlloc", GlobalAddressArgs.builder()
            .name("alloydb-source-cluster")
            .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(source.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(source.name())
            .build(), CustomResourceOptions.builder()
                .dependsOn(sourceInstance)
                .build());

        var restoredFromBackup = new Cluster("restoredFromBackup", ClusterArgs.builder()
            .clusterId("alloydb-backup-restored")
            .location("us-central1")
            .networkConfig(ClusterNetworkConfigArgs.builder()
                .network(default_.id())
                .build())
            .restoreBackupSource(ClusterRestoreBackupSourceArgs.builder()
                .backupName(sourceBackup.name())
                .build())
            .deletionProtection(false)
            .build());

        var restoredViaPitr = new Cluster("restoredViaPitr", ClusterArgs.builder()
            .clusterId("alloydb-pitr-restored")
            .location("us-central1")
            .networkConfig(ClusterNetworkConfigArgs.builder()
                .network(default_.id())
                .build())
            .restoreContinuousBackupSource(ClusterRestoreContinuousBackupSourceArgs.builder()
                .cluster(source.name())
                .pointInTime("2023-08-03T19:19:00.094Z")
                .build())
            .deletionProtection(false)
            .build());

        final var project = OrganizationsFunctions.getProject(GetProjectArgs.builder()
            .build());

    }
}
resources:
  source:
    type: gcp:alloydb:Cluster
    properties:
      clusterId: alloydb-source-cluster
      location: us-central1
      network: ${default.id}
      initialUser:
        password: alloydb-source-cluster
      deletionProtection: false
  sourceInstance:
    type: gcp:alloydb:Instance
    name: source
    properties:
      cluster: ${source.name}
      instanceId: alloydb-instance
      instanceType: PRIMARY
      machineConfig:
        cpuCount: 2
    options:
      dependsOn:
        - ${vpcConnection}
  sourceBackup:
    type: gcp:alloydb:Backup
    name: source
    properties:
      backupId: alloydb-backup
      location: us-central1
      clusterName: ${source.name}
    options:
      dependsOn:
        - ${sourceInstance}
  restoredFromBackup:
    type: gcp:alloydb:Cluster
    name: restored_from_backup
    properties:
      clusterId: alloydb-backup-restored
      location: us-central1
      networkConfig:
        network: ${default.id}
      restoreBackupSource:
        backupName: ${sourceBackup.name}
      deletionProtection: false
  restoredViaPitr:
    type: gcp:alloydb:Cluster
    name: restored_via_pitr
    properties:
      clusterId: alloydb-pitr-restored
      location: us-central1
      networkConfig:
        network: ${default.id}
      restoreContinuousBackupSource:
        cluster: ${source.name}
        pointInTime: 2023-08-03T19:19:00.094Z
      deletionProtection: false
  privateIpAlloc:
    type: gcp:compute:GlobalAddress
    name: private_ip_alloc
    properties:
      name: alloydb-source-cluster
      addressType: INTERNAL
      purpose: VPC_PEERING
      prefixLength: 16
      network: ${default.id}
  vpcConnection:
    type: gcp:servicenetworking:Connection
    name: vpc_connection
    properties:
      network: ${default.id}
      service: servicenetworking.googleapis.com
      reservedPeeringRanges:
        - ${privateIpAlloc.name}
variables:
  project:
    fn::invoke:
      function: gcp:organizations:getProject
      arguments: {}
  default:
    fn::invoke:
      function: gcp:compute:getNetwork
      arguments:
        name: alloydb-network

Alloydb Secondary Cluster Basic

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const _default = new gcp.compute.Network("default", {name: "alloydb-secondary-cluster"});
const primary = new gcp.alloydb.Cluster("primary", {
    clusterId: "alloydb-primary-cluster",
    location: "us-central1",
    networkConfig: {
        network: _default.id,
    },
    deletionProtection: false,
});
const privateIpAlloc = new gcp.compute.GlobalAddress("private_ip_alloc", {
    name: "alloydb-secondary-cluster",
    addressType: "INTERNAL",
    purpose: "VPC_PEERING",
    prefixLength: 16,
    network: _default.id,
});
const vpcConnection = new gcp.servicenetworking.Connection("vpc_connection", {
    network: _default.id,
    service: "servicenetworking.googleapis.com",
    reservedPeeringRanges: [privateIpAlloc.name],
});
const primaryInstance = new gcp.alloydb.Instance("primary", {
    cluster: primary.name,
    instanceId: "alloydb-primary-instance",
    instanceType: "PRIMARY",
    machineConfig: {
        cpuCount: 2,
    },
}, {
    dependsOn: [vpcConnection],
});
const secondary = new gcp.alloydb.Cluster("secondary", {
    clusterId: "alloydb-secondary-cluster",
    location: "us-east1",
    networkConfig: {
        network: _default.id,
    },
    clusterType: "SECONDARY",
    continuousBackupConfig: {
        enabled: false,
    },
    secondaryConfig: {
        primaryClusterName: primary.name,
    },
    deletionProtection: false,
}, {
    dependsOn: [primaryInstance],
});
const project = gcp.organizations.getProject({});
import pulumi
import pulumi_gcp as gcp

default = gcp.compute.Network("default", name="alloydb-secondary-cluster")
primary = gcp.alloydb.Cluster("primary",
    cluster_id="alloydb-primary-cluster",
    location="us-central1",
    network_config={
        "network": default.id,
    },
    deletion_protection=False)
private_ip_alloc = gcp.compute.GlobalAddress("private_ip_alloc",
    name="alloydb-secondary-cluster",
    address_type="INTERNAL",
    purpose="VPC_PEERING",
    prefix_length=16,
    network=default.id)
vpc_connection = gcp.servicenetworking.Connection("vpc_connection",
    network=default.id,
    service="servicenetworking.googleapis.com",
    reserved_peering_ranges=[private_ip_alloc.name])
primary_instance = gcp.alloydb.Instance("primary",
    cluster=primary.name,
    instance_id="alloydb-primary-instance",
    instance_type="PRIMARY",
    machine_config={
        "cpu_count": 2,
    },
    opts = pulumi.ResourceOptions(depends_on=[vpc_connection]))
secondary = gcp.alloydb.Cluster("secondary",
    cluster_id="alloydb-secondary-cluster",
    location="us-east1",
    network_config={
        "network": default.id,
    },
    cluster_type="SECONDARY",
    continuous_backup_config={
        "enabled": False,
    },
    secondary_config={
        "primary_cluster_name": primary.name,
    },
    deletion_protection=False,
    opts = pulumi.ResourceOptions(depends_on=[primary_instance]))
project = gcp.organizations.get_project()
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() =>
{
    var @default = new Gcp.Compute.Network("default", new()
    {
        Name = "alloydb-secondary-cluster",
    });

    var primary = new Gcp.Alloydb.Cluster("primary", new()
    {
        ClusterId = "alloydb-primary-cluster",
        Location = "us-central1",
        NetworkConfig = new Gcp.Alloydb.Inputs.ClusterNetworkConfigArgs
        {
            Network = @default.Id,
        },
        DeletionProtection = false,
    });

    var privateIpAlloc = new Gcp.Compute.GlobalAddress("private_ip_alloc", new()
    {
        Name = "alloydb-secondary-cluster",
        AddressType = "INTERNAL",
        Purpose = "VPC_PEERING",
        PrefixLength = 16,
        Network = @default.Id,
    });

    var vpcConnection = new Gcp.ServiceNetworking.Connection("vpc_connection", new()
    {
        Network = @default.Id,
        Service = "servicenetworking.googleapis.com",
        ReservedPeeringRanges = new[]
        {
            privateIpAlloc.Name,
        },
    });

    var primaryInstance = new Gcp.Alloydb.Instance("primary", new()
    {
        Cluster = primary.Name,
        InstanceId = "alloydb-primary-instance",
        InstanceType = "PRIMARY",
        MachineConfig = new Gcp.Alloydb.Inputs.InstanceMachineConfigArgs
        {
            CpuCount = 2,
        },
    }, new CustomResourceOptions
    {
        DependsOn =
        {
            vpcConnection,
        },
    });

    var secondary = new Gcp.Alloydb.Cluster("secondary", new()
    {
        ClusterId = "alloydb-secondary-cluster",
        Location = "us-east1",
        NetworkConfig = new Gcp.Alloydb.Inputs.ClusterNetworkConfigArgs
        {
            Network = @default.Id,
        },
        ClusterType = "SECONDARY",
        ContinuousBackupConfig = new Gcp.Alloydb.Inputs.ClusterContinuousBackupConfigArgs
        {
            Enabled = false,
        },
        SecondaryConfig = new Gcp.Alloydb.Inputs.ClusterSecondaryConfigArgs
        {
            PrimaryClusterName = primary.Name,
        },
        DeletionProtection = false,
    }, new CustomResourceOptions
    {
        DependsOn =
        {
            primaryInstance,
        },
    });

    var project = Gcp.Organizations.GetProject.Invoke();

});
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/alloydb"
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/compute"
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/organizations"
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/servicenetworking"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_default, err := compute.NewNetwork(ctx, "default", &compute.NetworkArgs{
			Name: pulumi.String("alloydb-secondary-cluster"),
		})
		if err != nil {
			return err
		}
		primary, err := alloydb.NewCluster(ctx, "primary", &alloydb.ClusterArgs{
			ClusterId: pulumi.String("alloydb-primary-cluster"),
			Location:  pulumi.String("us-central1"),
			NetworkConfig: &alloydb.ClusterNetworkConfigArgs{
				Network: _default.ID().ToIDOutput().ToStringOutput(),
			},
			DeletionProtection: pulumi.Bool(false),
		})
		if err != nil {
			return err
		}
		privateIpAlloc, err := compute.NewGlobalAddress(ctx, "private_ip_alloc", &compute.GlobalAddressArgs{
			Name:         pulumi.String("alloydb-secondary-cluster"),
			AddressType:  pulumi.String("INTERNAL"),
			Purpose:      pulumi.String("VPC_PEERING"),
			PrefixLength: pulumi.Int(16),
			Network:      _default.ID().ToIDOutput().ToStringOutput(),
		})
		if err != nil {
			return err
		}
		vpcConnection, err := servicenetworking.NewConnection(ctx, "vpc_connection", &servicenetworking.ConnectionArgs{
			Network: _default.ID().ToIDOutput().ToStringOutput(),
			Service: pulumi.String("servicenetworking.googleapis.com"),
			ReservedPeeringRanges: pulumi.StringArray{
				privateIpAlloc.Name,
			},
		})
		if err != nil {
			return err
		}
		primaryInstance, err := alloydb.NewInstance(ctx, "primary", &alloydb.InstanceArgs{
			Cluster:      primary.Name,
			InstanceId:   pulumi.String("alloydb-primary-instance"),
			InstanceType: pulumi.String("PRIMARY"),
			MachineConfig: &alloydb.InstanceMachineConfigArgs{
				CpuCount: pulumi.Int(2),
			},
		}, pulumi.DependsOn([]pulumi.Resource{
			vpcConnection,
		}))
		if err != nil {
			return err
		}
		_, err = alloydb.NewCluster(ctx, "secondary", &alloydb.ClusterArgs{
			ClusterId: pulumi.String("alloydb-secondary-cluster"),
			Location:  pulumi.String("us-east1"),
			NetworkConfig: &alloydb.ClusterNetworkConfigArgs{
				Network: _default.ID().ToIDOutput().ToStringOutput(),
			},
			ClusterType: pulumi.String("SECONDARY"),
			ContinuousBackupConfig: &alloydb.ClusterContinuousBackupConfigArgs{
				Enabled: pulumi.Bool(false),
			},
			SecondaryConfig: &alloydb.ClusterSecondaryConfigArgs{
				PrimaryClusterName: primary.Name,
			},
			DeletionProtection: pulumi.Bool(false),
		}, pulumi.DependsOn([]pulumi.Resource{
			primaryInstance,
		}))
		if err != nil {
			return err
		}
		_, err = organizations.LookupProject(ctx, &organizations.LookupProjectArgs{}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    gcp = {
      source = "pulumi/gcp"
    }
  }
}

data "gcp_organizations_getproject" "project" {
}

resource "gcp_alloydb_cluster" "primary" {
  cluster_id = "alloydb-primary-cluster"
  location   = "us-central1"
  network_config = {
    network = gcp_compute_network.default.id
  }
  deletion_protection = false
}
resource "gcp_alloydb_instance" "primary" {
  depends_on    = [gcp_servicenetworking_connection.vpc_connection]
  cluster       = gcp_alloydb_cluster.primary.name
  instance_id   = "alloydb-primary-instance"
  instance_type = "PRIMARY"
  machine_config = {
    cpu_count = 2
  }
}
resource "gcp_alloydb_cluster" "secondary" {
  depends_on = [gcp_alloydb_instance.primary]
  cluster_id = "alloydb-secondary-cluster"
  location   = "us-east1"
  network_config = {
    network = gcp_compute_network.default.id
  }
  cluster_type = "SECONDARY"
  continuous_backup_config = {
    enabled = false
  }
  secondary_config = {
    primary_cluster_name = gcp_alloydb_cluster.primary.name
  }
  deletion_protection = false
}
resource "gcp_compute_network" "default" {
  name = "alloydb-secondary-cluster"
}
resource "gcp_compute_globaladdress" "private_ip_alloc" {
  name          = "alloydb-secondary-cluster"
  address_type  = "INTERNAL"
  purpose       = "VPC_PEERING"
  prefix_length = 16
  network       = gcp_compute_network.default.id
}
resource "gcp_servicenetworking_connection" "vpc_connection" {
  network                 = gcp_compute_network.default.id
  service                 = "servicenetworking.googleapis.com"
  reserved_peering_ranges = [gcp_compute_globaladdress.private_ip_alloc.name]
}
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.compute.NetworkArgs;
import com.pulumi.gcp.alloydb.Cluster;
import com.pulumi.gcp.alloydb.ClusterArgs;
import com.pulumi.gcp.alloydb.inputs.ClusterNetworkConfigArgs;
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.ArrayList;
import java.util.Arrays;
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", NetworkArgs.builder()
            .name("alloydb-secondary-cluster")
            .build());

        var primary = new Cluster("primary", ClusterArgs.builder()
            .clusterId("alloydb-primary-cluster")
            .location("us-central1")
            .networkConfig(ClusterNetworkConfigArgs.builder()
                .network(default_.id())
                .build())
            .deletionProtection(false)
            .build());

        var privateIpAlloc = new GlobalAddress("privateIpAlloc", GlobalAddressArgs.builder()
            .name("alloydb-secondary-cluster")
            .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(primary.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")
            .networkConfig(ClusterNetworkConfigArgs.builder()
                .network(default_.id())
                .build())
            .clusterType("SECONDARY")
            .continuousBackupConfig(ClusterContinuousBackupConfigArgs.builder()
                .enabled(false)
                .build())
            .secondaryConfig(ClusterSecondaryConfigArgs.builder()
                .primaryClusterName(primary.name())
                .build())
            .deletionProtection(false)
            .build(), CustomResourceOptions.builder()
                .dependsOn(primaryInstance)
                .build());

        final var project = OrganizationsFunctions.getProject(GetProjectArgs.builder()
            .build());

    }
}
resources:
  primary:
    type: gcp:alloydb:Cluster
    properties:
      clusterId: alloydb-primary-cluster
      location: us-central1
      networkConfig:
        network: ${default.id}
      deletionProtection: false
  primaryInstance:
    type: gcp:alloydb:Instance
    name: primary
    properties:
      cluster: ${primary.name}
      instanceId: alloydb-primary-instance
      instanceType: PRIMARY
      machineConfig:
        cpuCount: 2
    options:
      dependsOn:
        - ${vpcConnection}
  secondary:
    type: gcp:alloydb:Cluster
    properties:
      clusterId: alloydb-secondary-cluster
      location: us-east1
      networkConfig:
        network: ${default.id}
      clusterType: SECONDARY
      continuousBackupConfig:
        enabled: false
      secondaryConfig:
        primaryClusterName: ${primary.name}
      deletionProtection: false
    options:
      dependsOn:
        - ${primaryInstance}
  default:
    type: gcp:compute:Network
    properties:
      name: alloydb-secondary-cluster
  privateIpAlloc:
    type: gcp:compute:GlobalAddress
    name: private_ip_alloc
    properties:
      name: alloydb-secondary-cluster
      addressType: INTERNAL
      purpose: VPC_PEERING
      prefixLength: 16
      network: ${default.id}
  vpcConnection:
    type: gcp:servicenetworking:Connection
    name: vpc_connection
    properties:
      network: ${default.id}
      service: servicenetworking.googleapis.com
      reservedPeeringRanges:
        - ${privateIpAlloc.name}
variables:
  project:
    fn::invoke:
      function: gcp:organizations:getProject
      arguments: {}

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

When using the pulumi import command, 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

Cluster(String name, {ClusterArgs? args, CustomResourceOptions? options})
Creates a new Cluster. name The Pulumi resource name. args Arguments used to configure this Cluster. The set of arguments for Cluster. options Resource options controlling this resource's behavior.
Cluster.reference(String urn)
Creates a typed reference to an existing Cluster resource.

Properties

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" }.
latefinal
automatedBackupPolicy ↔ Output<ClusterAutomatedBackupPolicy>
The automated backup policy for this cluster. AutomatedBackupPolicy is disabled by default. Structure is documented below.
latefinal
backupdrBackupSources ↔ Output<List<ClusterBackupdrBackupSource>>
Cluster created from a BackupDR backup. Structure is documented below.
latefinal
backupSources ↔ Output<List<ClusterBackupSource>>
Cluster created from backup. Structure is documented below.
latefinal
childResources → Set<Resource>
finalinherited
clusterId ↔ Output<String>
The ID of the alloydb cluster.
latefinal
clusterType ↔ Output<String?>
The type of cluster. If not set, defaults to PRIMARY. Default value is PRIMARY. Possible values are: PRIMARY, SECONDARY.
latefinal
completionSources ↔ Map<String, IOutputCompletionSource>
latefinalinherited
continuousBackupConfig ↔ Output<ClusterContinuousBackupConfig>
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.
latefinal
continuousBackupInfos ↔ Output<List<ClusterContinuousBackupInfo>>
ContinuousBackupInfo describes the continuous backup properties of a cluster. Structure is documented below.
latefinal
databaseVersion ↔ Output<String>
The database engine major version. This is an optional field and it's populated at the Cluster creation time. Note: Changing this field to a higer version results in upgrading the AlloyDB cluster which is an irreversible change.
latefinal
dataplexConfig ↔ Output<ClusterDataplexConfig>
Configuration for Dataplex integration. This is an optional field. If not set, Dataplex integration will be enabled by default. Structure is documented below.
latefinal
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 deletionPolicy = "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.
latefinal
deletionProtection ↔ Output<bool?>
Whether Terraform will be prevented from destroying the cluster. When the field is set to true or unset in Terraform state, a pulumi up or terraform destroy that would delete the cluster will fail. When the field is set to false, deleting the cluster is allowed.
latefinal
displayName ↔ Output<String?>
User-settable and human-readable display name for the Cluster.
latefinal
effectiveAnnotations ↔ Output<Map<String, String>>
All of annotations (key/value pairs) present on the resource in GCP, including the annotations configured through Terraform, other clients and services.
latefinal
effectiveLabels ↔ Output<Map<String, String>>
All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
latefinal
encryptionConfig ↔ Output<ClusterEncryptionConfig?>
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.
latefinal
encryptionInfos ↔ Output<List<ClusterEncryptionInfo>>
(Output) Output only. The encryption information for the WALs and backups required for ContinuousBackup. Structure is documented below.
latefinal
etag ↔ Output<String?>
For Resource freshness validation (https://google.aip.dev/154)
latefinal
hashCode → int
The hash code for this object.
no setterinherited
id ↔ Output<String>
getter/setter pairinherited
initialUser ↔ Output<ClusterInitialUser?>
Initial user to setup during cluster creation. If unset for new Clusters, a postgres role with null password is created. You will need to create additional users or set the password in order to log in. Structure is documented below.
latefinal
isCustom → bool
Returns whether this resource is provider-managed.
no setterinherited
isProtected → bool
Returns whether this resource is protected from deletion.
no setterinherited
isRemote → bool
Whether this resource is registered as remote.
no setterinherited
isResourceReference → bool
Whether this instance represents a resource value returned over RPC.
finalinherited
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 effectiveLabels for all of the labels present on the resource.
latefinal
location ↔ Output<String>
The location where the alloydb cluster should reside.
latefinal
maintenanceUpdatePolicy ↔ Output<ClusterMaintenanceUpdatePolicy?>
MaintenanceUpdatePolicy defines the policy for system updates. Structure is documented below.
latefinal
migrationSources ↔ Output<List<ClusterMigrationSource>>
Cluster created via DMS migration. Structure is documented below.
latefinal
name ↔ Output<String>
The name of the cluster resource.
latefinal
networkConfig ↔ Output<ClusterNetworkConfig>
Metadata related to network configuration. Structure is documented below.
latefinal
project ↔ Output<String>
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
latefinal
pscConfig ↔ Output<ClusterPscConfig?>
Configuration for Private Service Connect (PSC) for the cluster. Structure is documented below.
latefinal
pulumiLabels ↔ Output<Map<String, String>>
The combination of labels configured directly on the resource and default labels configured on the provider.
latefinal
reconciling ↔ Output<bool>
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.
latefinal
resourceTransforms → List<ResourceTransform>
Inherited/explicit async transforms.
no setterinherited
restoreBackupdrBackupSource ↔ Output<ClusterRestoreBackupdrBackupSource?>
The source when restoring from a backup. Conflicts with 'restore_continuous_backup_source', 'restore_backup_source' and 'restore_backupdr_pitr_source', they can't be set together. Structure is documented below.
latefinal
restoreBackupdrPitrSource ↔ Output<ClusterRestoreBackupdrPitrSource?>
The BackupDR source used for point in time recovery. Conflicts with 'restore_backupdr_backup_source', 'restore_continuous_backup_source' and 'restore_backupdr_backup_source', they can't be set togeter. Structure is documented below.
latefinal
restoreBackupSource ↔ Output<ClusterRestoreBackupSource?>
The source when restoring from a backup. Conflicts with 'restore_continuous_backup_source', 'restore_backupdr_backup_source' and 'restore_backupdr_pitr_source', they can't be set together. Structure is documented below.
latefinal
restoreContinuousBackupSource ↔ Output<ClusterRestoreContinuousBackupSource?>
The source when restoring via point in time recovery (PITR). Conflicts with 'restore_backup_source', 'restore_backupdr_backup_source' and 'restore_backupdr_pitr_source', they can't be set together. Structure is documented below.
latefinal
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
secondaryConfig ↔ Output<ClusterSecondaryConfig?>
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.
latefinal
skipAwaitMajorVersionUpgrade ↔ Output<bool?>
Set to true to skip awaiting on the major version upgrade of the cluster. Possible values: true, false Default value: "true"
latefinal
state ↔ Output<String>
Output only. The current serving state of the cluster.
latefinal
subscriptionType ↔ Output<String>
The subscrition type of cluster. Possible values are: TRIAL, STANDARD.
latefinal
transformations → List<ResourceTransformation>
Inherited/explicit legacy transformations.
no setterinherited
trialMetadatas ↔ Output<List<ClusterTrialMetadata>>
Contains information and all metadata related to TRIAL clusters. Structure is documented below.
latefinal
uid ↔ Output<String>
The system-generated UID of the resource.
latefinal
urn ↔ Output<String>
latefinalinherited

Methods

failId(Object error) → void
Completes this resource ID with an error when registration fails.
inherited
failOutputs(Object error) → void
Completes all output properties with error.
inherited
failUrn(Object error) → void
Completes this resource URN with an error when registration fails.
inherited
getProvider(String moduleMember) → ProviderResource?
Returns provider for moduleMember's package, if configured.
inherited
getResourceName() → String
Returns this resource's logical name.
inherited
getResourceType() → String
Returns this resource's Pulumi type token.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerOutput<T>(String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output<T>
Registers a dynamic output property for this resource.
inherited
resolveId(String? value, {required bool isKnown}) → void
Resolves the provider-assigned ID for this resource.
inherited
resolveOutputs(Struct outputs) → void
Resolves all output properties from a monitor response payload.
inherited
resolveUrn(String value) → void
Resolves this resource's URN once assigned by the engine.
inherited
serializeProperties(Map<String, dynamic> properties) → Future<Struct>
Serializes resource properties for RPC transmission.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

get(String name, Input<String> id, {ClusterState? state, CustomResourceOptions? options}) → Cluster
Gets an existing Cluster resource's state with the given name and id.