Instance
A managed alloydb cluster instance. To get more information about Instance, see:
How-to Guides
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}}
Properties
Annotations to allow client tools to store small amount of arbitrary data. This is distinct from labels.
'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
.
Time the Instance was created in UTC.
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.
User-settable and human-readable display name for the Instance.
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.
The ID of the alloydb instance.
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
.
Configurations for the machines that host the underlying database engine. Structure is documented below.
Read pool specific config. If the instance type is READ_POOL, this configuration must be provided. Structure is documented below.
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.
Time the Instance was updated in UTC.