A Google Cloud Memcache instance.
To get more information about Instance, see:
// This example assumes this network already exists.
// The API creates a tenant network per network authorized for a
// Memcache instance and that network is not deleted when the user-created
// network (authorized_network) is deleted, so this prevents issues
// with tenant network quota.
// If this network hasn't been created and you are using this example in your
// config, add an additional network resource or change
// this from "data"to "resource"
resource "google_compute_network" "memcache_network" {
name = "test-network"
}
resource "google_compute_global_address" "service_range" {
name = "address"
purpose = "VPC_PEERING"
address_type = "INTERNAL"
prefix_length = 16
network = google_compute_network.memcache_network.id
}
resource "google_service_networking_connection" "private_service_connection" {
network = google_compute_network.memcache_network.id
service = "servicenetworking.googleapis.com"
reserved_peering_ranges = [google_compute_global_address.service_range.name]
}
resource "google_memcache_instance" "instance" {
name = "test-instance"
authorized_network = google_service_networking_connection.private_service_connection.network
labels = {
env = "test"
}
node_config {
cpu_count = 1
memory_size_mb = 1024
}
node_count = 1
memcache_version = "MEMCACHE_1_5"
maintenance_policy {
weekly_maintenance_window {
day = "SATURDAY"
duration = "14400s"
start_time {
hours = 0
minutes = 30
seconds = 0
nanos = 0
}
}
}
}
The following arguments are supported:
name
-
(Required)
The resource name of the instance.
node_count
-
(Required)
Number of nodes in the memcache instance.
node_config
-
(Required)
Configuration for memcache nodes.
Structure is documented below.
The node_config
block supports:
cpu_count
-
(Required)
Number of CPUs per node.
memory_size_mb
-
(Required)
Memory size in Mebibytes for each memcache node.
display_name
-
(Optional)
A user-visible name for the instance.
labels
-
(Optional)
Resource labels to represent user-provided metadata.
Note: This field is non-authoritative, and will only manage the labels present in your configuration.
Please refer to the field effective_labels
for all of the labels present on the resource.
zones
-
(Optional)
Zones where memcache nodes should be provisioned. If not
provided, all zones will be used.
authorized_network
-
(Optional)
The full name of the GCE network to connect the instance to. If not provided,
'default' will be used.
memcache_version
-
(Optional)
The major version of Memcached software. If not provided, latest supported version will be used.
Currently the latest supported major version is MEMCACHE_1_5. The minor version will be automatically
determined by our system based on the latest supported minor version.
Default value is MEMCACHE_1_5
.
Possible values are: MEMCACHE_1_5
, MEMCACHE_1_6_15
.
memcache_parameters
-
(Optional)
User-specified parameters for this memcache instance.
Structure is documented below.
maintenance_policy
-
(Optional)
Maintenance policy for an instance.
Structure is documented below.
reserved_ip_range_id
-
(Optional)
Contains the name of allocated IP address ranges associated with
the private service access connection for example, "test-default"
associated with IP range 10.0.0.0/29.
region
-
(Optional)
The region of the Memcache instance. If it is not provided, the provider region is used.
project
- (Optional) The ID of the project in which the resource belongs.
If it is not provided, the provider project is used.
The memcache_parameters
block supports:
id
-
(Output)
This is a unique ID associated with this set of parameters.
params
-
(Optional)
User-defined set of parameters to use in the memcache process.
The maintenance_policy
block supports:
create_time
-
(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
update_time
-
(Output)
Output only. The time when the policy was updated.
A timestamp in RFC3339 UTC "Zulu" format, with nanosecond
resolution and up to nine fractional digits.
description
-
(Optional)
Optional. Description of what this policy is for.
Create/Update methods return INVALID_ARGUMENT if the
length is greater than 512.
weekly_maintenance_window
-
(Required)
Required. Maintenance window that is applied to resources covered by this policy.
Minimum 1. For the current version, the maximum number of weekly_maintenance_windows
is expected to be one.
Structure is documented below.
The weekly_maintenance_window
block supports:
day
-
(Required)
Required. The day of week that maintenance updates occur.
DAY_OF_WEEK_UNSPECIFIED
, MONDAY
, TUESDAY
, WEDNESDAY
, THURSDAY
, FRIDAY
, SATURDAY
, SUNDAY
.duration
-
(Required)
Required. The length of the maintenance window, ranging from 3 hours to 8 hours.
A duration in seconds with up to nine fractional digits,
terminated by 's'. Example: "3.5s".
start_time
-
(Required)
Required. Start time of the window in UTC time.
Structure is documented below.
The start_time
block supports:
hours
-
(Optional)
Hours of day in 24 hour format. Should be from 0 to 23.
An API may choose to allow the value "24:00:00" for scenarios like business closing time.
minutes
-
(Optional)
Minutes of hour of day. Must be from 0 to 59.
seconds
-
(Optional)
Seconds of minutes of the time. Must normally be from 0 to 59.
An API may allow the value 60 if it allows leap-seconds.
nanos
-
(Optional)
Fractions of seconds in nanoseconds. Must be from 0 to 999,999,999.
In addition to the arguments listed above, the following computed attributes are exported:
id
- an identifier for the resource with format projects/{{project}}/locations/{{region}}/instances/{{name}}
memcache_nodes
-
Additional information about the instance state, if available.
Structure is documented below.
create_time
-
Creation timestamp in RFC3339 text format.
discovery_endpoint
-
Endpoint for Discovery API
memcache_full_version
-
The full version of memcached server running on this instance.
maintenance_schedule
-
Output only. Published maintenance schedule.
Structure is documented below.
terraform_labels
-
The combination of labels configured directly on the resource
and default labels configured on the provider.
effective_labels
-
All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Terraform, other clients and services.
The memcache_nodes
block contains:
node_id
-
(Output)
Identifier of the Memcached node. The node id does not include project or location like the Memcached instance name.
zone
-
(Output)
Location (GCP Zone) for the Memcached node.
port
-
(Output)
The port number of the Memcached server on this node.
host
-
(Output)
Hostname or IP address of the Memcached node used by the clients to connect to the Memcached server on this node.
state
-
(Output)
Current state of the Memcached node.
The maintenance_schedule
block contains:
start_time
-
(Output)
Output only. The start time of any upcoming scheduled maintenance for this instance.
A timestamp in RFC3339 UTC "Zulu" format, with nanosecond
resolution and up to nine fractional digits.
end_time
-
(Output)
Output only. The end time of any upcoming scheduled maintenance for this instance.
A timestamp in RFC3339 UTC "Zulu" format, with nanosecond
resolution and up to nine fractional digits.
schedule_deadline_time
-
(Output)
Output only. The deadline that the maintenance schedule start time
can not go beyond, including reschedule.
A timestamp in RFC3339 UTC "Zulu" format, with nanosecond
resolution and up to nine fractional digits.
This resource provides the following Timeouts configuration options:
create
- Default is 20 minutes.update
- Default is 20 minutes.delete
- Default is 20 minutes.Instance can be imported using any of these accepted formats:
projects/{{project}}/locations/{{region}}/instances/{{name}}
{{project}}/{{region}}/{{name}}
{{region}}/{{name}}
{{name}}
In Terraform v1.5.0 and later, use an import
block to import Instance using one of the formats above. For example:
import {
id = "projects/{{project}}/locations/{{region}}/instances/{{name}}"
to = google_memcache_instance.default
}
When using the terraform import
command, Instance can be imported using one of the formats above. For example:
$ terraform import google_memcache_instance.default projects/{{project}}/locations/{{region}}/instances/{{name}}
$ terraform import google_memcache_instance.default {{project}}/{{region}}/{{name}}
$ terraform import google_memcache_instance.default {{region}}/{{name}}
$ terraform import google_memcache_instance.default {{name}}
This resource supports User Project Overrides.