Instance

class Instance : KotlinCustomResource

A Google Cloud Redis instance. To get more information about Instance, see:

Example Usage

Redis Instance Basic

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.redis.Instance;
import com.pulumi.gcp.redis.InstanceArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var cache = new Instance("cache", InstanceArgs.builder()
.memorySizeGb(1)
.build());
}
}

Redis Instance Full

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.redis.Instance;
import com.pulumi.gcp.redis.InstanceArgs;
import com.pulumi.gcp.redis.inputs.InstanceMaintenancePolicyArgs;
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 redis-network = ComputeFunctions.getNetwork(GetNetworkArgs.builder()
.name("redis-test-network")
.build());
var cache = new Instance("cache", InstanceArgs.builder()
.tier("STANDARD_HA")
.memorySizeGb(1)
.locationId("us-central1-a")
.alternativeLocationId("us-central1-f")
.authorizedNetwork(redis_network.id())
.redisVersion("REDIS_4_0")
.displayName("Test Instance")
.reservedIpRange("192.168.0.0/29")
.labels(Map.ofEntries(
Map.entry("my_key", "my_val"),
Map.entry("other_key", "other_val")
))
.maintenancePolicy(InstanceMaintenancePolicyArgs.builder()
.weeklyMaintenanceWindows(InstanceMaintenancePolicyWeeklyMaintenanceWindowArgs.builder()
.day("TUESDAY")
.startTime(InstanceMaintenancePolicyWeeklyMaintenanceWindowStartTimeArgs.builder()
.hours(0)
.minutes(30)
.seconds(0)
.nanos(0)
.build())
.build())
.build())
.build());
}
}

Redis Instance Full With Persistence Config

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.redis.Instance;
import com.pulumi.gcp.redis.InstanceArgs;
import com.pulumi.gcp.redis.inputs.InstancePersistenceConfigArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var cache_persis = new Instance("cache-persis", InstanceArgs.builder()
.alternativeLocationId("us-central1-f")
.locationId("us-central1-a")
.memorySizeGb(1)
.persistenceConfig(InstancePersistenceConfigArgs.builder()
.persistenceMode("RDB")
.rdbSnapshotPeriod("TWELVE_HOURS")
.build())
.tier("STANDARD_HA")
.build());
}
}

Redis Instance Private Service

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.compute.GlobalAddress;
import com.pulumi.gcp.compute.GlobalAddressArgs;
import com.pulumi.gcp.servicenetworking.Connection;
import com.pulumi.gcp.servicenetworking.ConnectionArgs;
import com.pulumi.gcp.redis.Instance;
import com.pulumi.gcp.redis.InstanceArgs;
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 redis-network = ComputeFunctions.getNetwork(GetNetworkArgs.builder()
.name("redis-test-network")
.build());
var serviceRange = new GlobalAddress("serviceRange", GlobalAddressArgs.builder()
.purpose("VPC_PEERING")
.addressType("INTERNAL")
.prefixLength(16)
.network(redis_network.id())
.build());
var privateServiceConnection = new Connection("privateServiceConnection", ConnectionArgs.builder()
.network(redis_network.id())
.service("servicenetworking.googleapis.com")
.reservedPeeringRanges(serviceRange.name())
.build());
var cache = new Instance("cache", InstanceArgs.builder()
.tier("STANDARD_HA")
.memorySizeGb(1)
.locationId("us-central1-a")
.alternativeLocationId("us-central1-f")
.authorizedNetwork(redis_network.id())
.connectMode("PRIVATE_SERVICE_ACCESS")
.redisVersion("REDIS_4_0")
.displayName("Test Instance")
.build(), CustomResourceOptions.builder()
.dependsOn(privateServiceConnection)
.build());
}
}

Redis Instance Mrr

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.redis.Instance;
import com.pulumi.gcp.redis.InstanceArgs;
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 redis-network = ComputeFunctions.getNetwork(GetNetworkArgs.builder()
.name("redis-test-network")
.build());
var cache = new Instance("cache", InstanceArgs.builder()
.tier("STANDARD_HA")
.memorySizeGb(5)
.locationId("us-central1-a")
.alternativeLocationId("us-central1-f")
.authorizedNetwork(redis_network.id())
.redisVersion("REDIS_6_X")
.displayName("Terraform Test Instance")
.reservedIpRange("192.168.0.0/28")
.replicaCount(5)
.readReplicasMode("READ_REPLICAS_ENABLED")
.labels(Map.ofEntries(
Map.entry("my_key", "my_val"),
Map.entry("other_key", "other_val")
))
.build());
}
}

Redis Instance Cmek

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.kms.KeyRing;
import com.pulumi.gcp.kms.KeyRingArgs;
import com.pulumi.gcp.kms.CryptoKey;
import com.pulumi.gcp.kms.CryptoKeyArgs;
import com.pulumi.gcp.compute.ComputeFunctions;
import com.pulumi.gcp.compute.inputs.GetNetworkArgs;
import com.pulumi.gcp.redis.Instance;
import com.pulumi.gcp.redis.InstanceArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var redisKeyring = new KeyRing("redisKeyring", KeyRingArgs.builder()
.location("us-central1")
.build());
var redisKey = new CryptoKey("redisKey", CryptoKeyArgs.builder()
.keyRing(redisKeyring.id())
.build());
final var redis-network = ComputeFunctions.getNetwork(GetNetworkArgs.builder()
.name("redis-test-network")
.build());
var cache = new Instance("cache", InstanceArgs.builder()
.tier("STANDARD_HA")
.memorySizeGb(1)
.locationId("us-central1-a")
.alternativeLocationId("us-central1-f")
.authorizedNetwork(redis_network.id())
.redisVersion("REDIS_6_X")
.displayName("Terraform Test Instance")
.reservedIpRange("192.168.0.0/29")
.labels(Map.ofEntries(
Map.entry("my_key", "my_val"),
Map.entry("other_key", "other_val")
))
.customerManagedKey(redisKey.id())
.build());
}
}

Import

Instance can be imported using any of these accepted formats

$ pulumi import gcp:redis/instance:Instance default projects/{{project}}/locations/{{region}}/instances/{{name}}
$ pulumi import gcp:redis/instance:Instance default {{project}}/{{region}}/{{name}}
$ pulumi import gcp:redis/instance:Instance default {{region}}/{{name}}
$ pulumi import gcp:redis/instance:Instance default {{name}}

Properties

Link copied to clipboard

Only applicable to STANDARD_HA tier which protects the instance against zonal failures by provisioning it across two zones. If provided, it must be a different zone from the one provided in locationId.

Link copied to clipboard
val authEnabled: Output<Boolean>?

Optional. Indicates whether OSS Redis AUTH is enabled for the instance. If set to "true" AUTH is enabled on the instance. Default value is "false" meaning AUTH is disabled.

Link copied to clipboard

The full name of the Google Compute Engine network to which the instance is connected. If left unspecified, the default network will be used.

Link copied to clipboard
val authString: Output<String>

AUTH String set on the instance. This field will only be populated if auth_enabled is true.

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

The connection mode of the Redis instance. Default value is DIRECT_PEERING. Possible values are: DIRECT_PEERING, PRIVATE_SERVICE_ACCESS.

Link copied to clipboard
val createTime: Output<String>

(Output) Output only. The time when the policy was created. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits.

Link copied to clipboard

The current zone where the Redis endpoint is placed. For Basic Tier instances, this will always be the same as the locationId provided by the user at creation time. For Standard Tier instances, this can be either locationId or alternativeLocationId and can change after a failover event.

Link copied to clipboard

Optional. The KMS key reference that you want to use to encrypt the data at rest for this Redis instance. If this is provided, CMEK is enabled.

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

An arbitrary and optional user-provided name for the instance.

Link copied to clipboard
val host: Output<String>

Hostname or IP address of the exposed Redis endpoint used by clients to connect to the service.

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

Resource labels to represent user provided metadata.

Link copied to clipboard
val locationId: Output<String>

The zone where the instance will be provisioned. If not provided, the service will choose a zone for the instance. For STANDARD_HA tier, instances will be created across two zones for protection against zonal failures. If alternativeLocationId is also provided, it must be different from locationId.

Link copied to clipboard

Maintenance policy for an instance. Structure is documented below.

Link copied to clipboard

Upcoming maintenance schedule. Structure is documented below.

Link copied to clipboard
val memorySizeGb: Output<Int>

Redis memory size in GiB.

Link copied to clipboard
val name: Output<String>

The ID of the instance or a fully qualified identifier for the instance.

Link copied to clipboard
val nodes: Output<List<InstanceNode>>

Output only. Info per node. Structure is documented below.

Link copied to clipboard

Persistence configuration for an instance. Structure is documented below.

Link copied to clipboard

Output only. Cloud IAM identity used by import / export operations to transfer data to/from Cloud Storage. Format is "serviceAccount:". The value may change over time for a given instance so should be checked before each import/export operation.

Link copied to clipboard
val port: Output<Int>

The port number of the exposed Redis endpoint.

Link copied to clipboard
val project: Output<String>

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val readEndpoint: Output<String>

Output only. Hostname or IP address of the exposed readonly Redis endpoint. Standard tier only. Targets all healthy replica nodes in instance. Replication is asynchronous and replica nodes will exhibit some lag behind the primary. Write requests must target 'host'.

Link copied to clipboard
val readEndpointPort: Output<Int>

Output only. The port number of the exposed readonly redis endpoint. Standard tier only. Write requests should target 'port'.

Link copied to clipboard

Optional. Read replica mode. Can only be specified when trying to create the instance. If not set, Memorystore Redis backend will default to READ_REPLICAS_DISABLED.

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

Redis configuration parameters, according to http://redis.io/topics/config. Please check Memorystore documentation for the list of supported parameters: https://cloud.google.com/memorystore/docs/redis/reference/rest/v1/projects.locations.instances#Instance.FIELDS.redis_configs

Link copied to clipboard
val redisVersion: Output<String>

The version of Redis software. If not provided, latest supported version will be used. Please check the API documentation linked at the top for the latest valid values.

Link copied to clipboard
val region: Output<String>

The name of the Redis region of the instance.

Link copied to clipboard
val replicaCount: Output<Int>

Optional. The number of replica nodes. The valid range for the Standard Tier with read replicas enabled is 1-5 and defaults to 2. If read replicas are not enabled for a Standard Tier instance, the only valid value is 1 and the default is 1. The valid value for basic tier is 0 and the default is also 0.

Link copied to clipboard
val reservedIpRange: Output<String>

The CIDR range of internal addresses that are reserved for this instance. If not provided, the service will choose an unused /29 block, for example, 10.0.0.0/29 or 192.168.0.0/29. Ranges must be unique and non-overlapping with existing subnets in an authorized network.

Link copied to clipboard

Optional. Additional IP range for node placement. Required when enabling read replicas on an existing instance. For DIRECT_PEERING mode value must be a CIDR range of size /28, or "auto". For PRIVATE_SERVICE_ACCESS mode value must be the name of an allocated address range associated with the private service access connection, or "auto".

Link copied to clipboard

List of server CA certificates for the instance. Structure is documented below.

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

The service tier of the instance. Must be one of these values:

Link copied to clipboard

The TLS mode of the Redis instance, If not provided, TLS is disabled for the instance.

Link copied to clipboard
val urn: Output<String>