» google_memcache_instance

A Google Cloud Memcache instance.

To get more information about Instance, see:

» Example Usage - Memcache Instance Basic

resource "google_compute_network" "network" {
  provider = google-beta
  name = "tf-test%{random_suffix}"
}

resource "google_compute_global_address" "service_range" {
  provider = google-beta
  name          = "tf-test%{random_suffix}"
  purpose       = "VPC_PEERING"
  address_type  = "INTERNAL"
  prefix_length = 16
  network       = google_compute_network.network.id
}

resource "google_service_networking_connection" "private_service_connection" {
  provider = google-beta
  network                 = google_compute_network.network.id
  service                 = "servicenetworking.googleapis.com"
  reserved_peering_ranges = [google_compute_global_address.service_range.name]
}

resource "google_memcache_instance" "instance" {
  provider = google-beta
  name = "test-instance"
  region = "us-central1"
  authorized_network = google_service_networking_connection.private_service_connection.network

  node_config {
    cpu_count      = 1
    memory_size_mb = 1024
  }
  node_count = 1
  memcache_version = "MEMCACHE_1_5"
}

» Argument Reference

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.

  • region - (Required) The name of the Memcache region of the instance.

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.

  • 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_parameters - (Optional) User-specified parameters for this memcache instance. Structure is documented below.

  • 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 - This is a unique ID associated with this set of parameters.

  • params - (Optional) User-defined set of parameters to use in the memcache process.

» Attributes Reference

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.

The memcache_nodes block contains:

  • node_id - Identifier of the Memcached node. The node id does not include project or location like the Memcached instance name.

  • zone - Location (GCP Zone) for the Memcached node.

  • port - The port number of the Memcached server on this node.

  • host - Hostname or IP address of the Memcached node used by the clients to connect to the Memcached server on this node.

  • state - Current state of the Memcached node.

» Timeouts

This resource provides the following Timeouts configuration options:

  • create - Default is 20 minutes.
  • update - Default is 20 minutes.
  • delete - Default is 20 minutes.

» Import

Instance can be imported using any of these accepted formats:

$ 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}}

» User Project Overrides

This resource supports User Project Overrides.