Skip to content

googleMemcacheInstance

A Google Cloud Memcache instance.

To get more information about Instance, see:

Example Usage - Memcache Instance Basic

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
const dataGoogleComputeNetworkMemcacheNetwork =
  new google.dataGoogleComputeNetwork.DataGoogleComputeNetwork(
    this,
    "memcache_network",
    {
      name: "test-network",
    }
  );
const googleComputeGlobalAddressServiceRange =
  new google.computeGlobalAddress.ComputeGlobalAddress(this, "service_range", {
    address_type: "INTERNAL",
    name: "address",
    network: dataGoogleComputeNetworkMemcacheNetwork.id,
    prefix_length: 16,
    purpose: "VPC_PEERING",
  });
const googleServiceNetworkingConnectionPrivateServiceConnection =
  new google.serviceNetworkingConnection.ServiceNetworkingConnection(
    this,
    "private_service_connection",
    {
      network: dataGoogleComputeNetworkMemcacheNetwork.id,
      reserved_peering_ranges: [googleComputeGlobalAddressServiceRange.name],
      service: "servicenetworking.googleapis.com",
    }
  );
new google.memcacheInstance.MemcacheInstance(this, "instance", {
  authorized_network:
    googleServiceNetworkingConnectionPrivateServiceConnection.network,
  maintenance_policy: [
    {
      weekly_maintenance_window: [
        {
          day: "SATURDAY",
          duration: "14400s",
          start_time: [
            {
              hours: 0,
              minutes: 30,
              nanos: 0,
              seconds: 0,
            },
          ],
        },
      ],
    },
  ],
  memcache_version: "MEMCACHE_1_5",
  name: "test-instance",
  node_config: [
    {
      cpu_count: 1,
      memory_size_mb: 1024,
    },
  ],
  node_count: 1,
});

Argument Reference

The following arguments are supported:

  • name - (Required) The resource name of the instance.

  • nodeCount - (Required) Number of nodes in the memcache instance.

  • nodeConfig - (Required) Configuration for memcache nodes. Structure is documented below.

The nodeConfig block supports:

  • cpuCount - (Required) Number of CPUs per node.

  • memorySizeMb - (Required) Memory size in Mebibytes for each memcache node.


  • displayName - (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.

  • authorizedNetwork - (Optional) The full name of the GCE network to connect the instance to. If not provided, 'default' will be used.

  • memcacheVersion - (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 memcache15. Possible values are memcache15.

  • memcacheParameters - (Optional) User-specified parameters for this memcache instance. Structure is documented below.

  • maintenancePolicy - (Optional) Maintenance policy for an instance. Structure is documented below.

  • 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 memcacheParameters 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 maintenancePolicy block supports:

  • createTime - (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

  • updateTime - (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.

  • weeklyMaintenanceWindow - (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 weeklyMaintenanceWindow block supports:

  • day - (Required) Required. The day of week that maintenance updates occur.

    • DAY_OF_WEEK_UNSPECIFIED: The day of the week is unspecified.
    • MONDAY: Monday
    • TUESDAY: Tuesday
    • WEDNESDAY: Wednesday
    • THURSDAY: Thursday
    • FRIDAY: Friday
    • SATURDAY: Saturday
    • SUNDAY: Sunday Possible values are dayOfWeekUnspecified, monday, tuesday, wednesday, thursday, friday, saturday, and 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".

  • startTime - (Required) Required. Start time of the window in UTC time. Structure is documented below.

The startTime 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.

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

  • memcacheNodes - Additional information about the instance state, if available. Structure is documented below.

  • createTime - Creation timestamp in RFC3339 text format.

  • discoveryEndpoint - Endpoint for Discovery API

  • memcacheFullVersion - The full version of memcached server running on this instance.

  • maintenanceSchedule - Output only. Published maintenance schedule. Structure is documented below.

The memcacheNodes block contains:

  • nodeId - (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 maintenanceSchedule block contains:

  • startTime - (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.

  • endTime - (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.

  • scheduleDeadlineTime - (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.

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.