Instance

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.organizations.OrganizationsFunctions;
import com.pulumi.gcp.organizations.inputs.GetProjectArgs;
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.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.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 project = OrganizationsFunctions.getProject();
var defaultNetwork = new Network("defaultNetwork", NetworkArgs.Empty, CustomResourceOptions.builder()
.provider(google_beta)
.build());
var defaultCluster = new Cluster("defaultCluster", ClusterArgs.builder()
.clusterId("alloydb-cluster")
.location("us-central1")
.network(defaultNetwork.name().applyValue(name -> String.format("projects/%s/global/networks/%s", project.applyValue(getProjectResult -> getProjectResult.number()),name)))
.initialUser(ClusterInitialUserArgs.builder()
.password("alloydb-cluster")
.build())
.build(), CustomResourceOptions.builder()
.provider(google_beta)
.build());
var privateIpAlloc = new GlobalAddress("privateIpAlloc", GlobalAddressArgs.builder()
.addressType("INTERNAL")
.purpose("VPC_PEERING")
.prefixLength(16)
.network(defaultNetwork.id())
.build(), CustomResourceOptions.builder()
.provider(google_beta)
.build());
var vpcConnection = new Connection("vpcConnection", ConnectionArgs.builder()
.network(defaultNetwork.id())
.service("servicenetworking.googleapis.com")
.reservedPeeringRanges(privateIpAlloc.name())
.build(), CustomResourceOptions.builder()
.provider(google_beta)
.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()
.provider(google_beta)
.dependsOn(vpcConnection)
.build());
}
}

Import

Instance can be imported using any of these accepted formats

$ pulumi import gcp:alloydb/instance:Instance default {{cluster}}/instances/{{instance_id}}
$ pulumi import gcp:alloydb/instance:Instance default {{cluster}}/{{instance_id}}

Properties

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

Annotations to allow client tools to store small amount of arbitrary data. This is distinct from labels.

Link copied to clipboard

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. Possible values are AVAILABILITY_TYPE_UNSPECIFIED, ZONAL, and REGIONAL.

Link copied to clipboard
val cluster: Output<String>

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

Link copied to clipboard
val createTime: Output<String>

Time the Instance was created in UTC.

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

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

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

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

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 id: Output<String>
Link copied to clipboard
val instanceId: Output<String>

The ID of the alloydb instance.

Link copied to clipboard
val instanceType: Output<String>

The type of the instance. Possible values are PRIMARY and READ_POOL.

Link copied to clipboard
val ipAddress: Output<String>

The IP address for the Instance. This is the connection endpoint for an end-user application.

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

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
val name: Output<String>

The name of the instance resource.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Read pool specific config. Structure is documented below.

Link copied to clipboard
val reconciling: Output<Boolean>

Set to true if the current state of Instance does not match the user's intended state, and the service is actively updating the resource to reconcile them. This can happen due to user-triggered updates or system actions like failover or maintenance.

Link copied to clipboard
val state: Output<String>

The current state of the alloydb instance.

Link copied to clipboard
val uid: Output<String>

The system-generated UID of the resource.

Link copied to clipboard
val updateTime: Output<String>

Time the Instance was updated in UTC.

Link copied to clipboard
val urn: Output<String>