InstanceArgs

data class InstanceArgs(val annotations: Output<Map<String, String>>? = null, val availabilityType: Output<String>? = null, val cluster: Output<String>? = null, val databaseFlags: Output<Map<String, String>>? = null, val displayName: Output<String>? = null, val gceZone: Output<String>? = null, val instanceId: Output<String>? = null, val instanceType: Output<String>? = null, val labels: Output<Map<String, String>>? = null, val machineConfig: Output<InstanceMachineConfigArgs>? = null, val readPoolConfig: Output<InstanceReadPoolConfigArgs>? = null) : ConvertibleToJava<InstanceArgs>

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

Example Usage

Alloydb Instance Basic

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.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 defaultNetwork = ComputeFunctions.getNetwork(GetNetworkArgs.builder()
.name("alloydb-network")
.build());
var defaultCluster = new Cluster("defaultCluster", ClusterArgs.builder()
.clusterId("alloydb-cluster")
.location("us-central1")
.network(defaultNetwork.applyValue(getNetworkResult -> getNetworkResult.id()))
.initialUser(ClusterInitialUserArgs.builder()
.password("alloydb-cluster")
.build())
.build());
var privateIpAlloc = new GlobalAddress("privateIpAlloc", GlobalAddressArgs.builder()
.addressType("INTERNAL")
.purpose("VPC_PEERING")
.prefixLength(16)
.network(defaultNetwork.applyValue(getNetworkResult -> getNetworkResult.id()))
.build());
var vpcConnection = new Connection("vpcConnection", ConnectionArgs.builder()
.network(defaultNetwork.applyValue(getNetworkResult -> getNetworkResult.id()))
.service("servicenetworking.googleapis.com")
.reservedPeeringRanges(privateIpAlloc.name())
.build());
var defaultInstance = new Instance("defaultInstance", InstanceArgs.builder()
.cluster(defaultCluster.name())
.instanceId("alloydb-instance")
.instanceType("PRIMARY")
.machineConfig(InstanceMachineConfigArgs.builder()
.cpuCount(2)
.build())
.build(), CustomResourceOptions.builder()
.dependsOn(vpcConnection)
.build());
final var project = OrganizationsFunctions.getProject();
}
}

Import

Instance can be imported using any of these accepted formats

$ pulumi import gcp:alloydb/instance:Instance default projects/{{project}}/locations/{{location}}/clusters/{{cluster}}/instances/{{instance_id}}
$ pulumi import gcp:alloydb/instance:Instance default {{project}}/{{location}}/{{cluster}}/{{instance_id}}
$ pulumi import gcp:alloydb/instance:Instance default {{location}}/{{cluster}}/{{instance_id}}

Constructors

Link copied to clipboard
constructor(annotations: Output<Map<String, String>>? = null, availabilityType: Output<String>? = null, cluster: Output<String>? = null, databaseFlags: Output<Map<String, String>>? = null, displayName: Output<String>? = null, gceZone: Output<String>? = null, instanceId: Output<String>? = null, instanceType: Output<String>? = null, labels: Output<Map<String, String>>? = null, machineConfig: Output<InstanceMachineConfigArgs>? = null, readPoolConfig: Output<InstanceReadPoolConfigArgs>? = null)

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.

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

'Availability type of an Instance. Defaults to REGIONAL for both primary and read instances. Note that primary and read instances can have different availability types. Only READ_POOL instance supports ZONAL type. Users can't specify the zone for READ_POOL instance. Zone is automatically chosen from the list of zones in the region specified. Read pool of size 1 can only have zonal availability. Read pools with node count of 2 or more can have regional availability (nodes are present in 2 or more zones in a region).' Possible values are: AVAILABILITY_TYPE_UNSPECIFIED, ZONAL, REGIONAL.

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

Identifies the alloydb cluster. Must be in the format 'projects/{project}/locations/{location}/clusters/{cluster_id}'

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

Database flags. Set at instance level. * They are copied from primary instance on read instance creation. * Read instances can set new or override existing flags that are relevant for reads, e.g. for enabling columnar cache on a read instance. Flags set on read instance may or may not be present on primary.

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

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

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

The Compute Engine zone that the instance should serve from, per https://cloud.google.com/compute/docs/regions-zones This can ONLY be specified for ZONAL instances. If present for a REGIONAL instance, an error will be thrown. If this is absent for a ZONAL instance, instance is created in a random zone with available capacity.

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

The ID of the alloydb instance.

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

The type of the instance. If the instance type is READ_POOL, provide the associated PRIMARY instance in the depends_on meta-data attribute. Possible values are: PRIMARY, READ_POOL.

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

User-defined labels for the alloydb instance.

Link copied to clipboard

Configurations for the machines that host the underlying database engine. Structure is documented below.

Link copied to clipboard

Read pool specific config. If the instance type is READ_POOL, this configuration must be provided. Structure is documented below.

Functions

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