| --- |
| # ---------------------------------------------------------------------------- |
| # |
| # *** AUTO GENERATED CODE *** Type: MMv1 *** |
| # |
| # ---------------------------------------------------------------------------- |
| # |
| # This file is automatically generated by Magic Modules and manual |
| # changes will be clobbered when the file is regenerated. |
| # |
| # Please read more about how to change this file in |
| # .github/CONTRIBUTING.md. |
| # |
| # ---------------------------------------------------------------------------- |
| subcategory: "Memcache" |
| description: |- |
| A Google Cloud Memcache instance. |
| --- |
| |
| # google\_memcache\_instance |
| |
| A Google Cloud Memcache instance. |
| |
| |
| To get more information about Instance, see: |
| |
| * [API documentation](https://cloud.google.com/memorystore/docs/memcached/reference/rest/v1/projects.locations.instances) |
| * How-to Guides |
| * [Official Documentation](https://cloud.google.com/memcache/docs/creating-instances) |
| |
| ## Example Usage - Memcache Instance Basic |
| |
| |
| ```hcl |
| // 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 |
| } |
| } |
| } |
| } |
| ``` |
| |
| ## 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](#nested_node_config). |
| |
| |
| <a name="nested_node_config"></a>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](#nested_memcache_parameters). |
| |
| * `maintenance_policy` - |
| (Optional) |
| Maintenance policy for an instance. |
| Structure is [documented below](#nested_maintenance_policy). |
| |
| * `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. |
| |
| |
| <a name="nested_memcache_parameters"></a>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. |
| |
| <a name="nested_maintenance_policy"></a>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](#nested_weekly_maintenance_window). |
| |
| |
| <a name="nested_weekly_maintenance_window"></a>The `weekly_maintenance_window` 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: `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](#nested_start_time). |
| |
| |
| <a name="nested_start_time"></a>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. |
| |
| ## 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](#nested_memcache_nodes). |
| |
| * `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](#nested_maintenance_schedule). |
| |
| * `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. |
| |
| |
| <a name="nested_memcache_nodes"></a>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. |
| |
| <a name="nested_maintenance_schedule"></a>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. |
| |
| ## Timeouts |
| |
| This resource provides the following |
| [Timeouts](https://developer.hashicorp.com/terraform/plugin/sdkv2/resources/retries-and-customizable-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: |
| |
| * `projects/{{project}}/locations/{{region}}/instances/{{name}}` |
| * `{{project}}/{{region}}/{{name}}` |
| * `{{region}}/{{name}}` |
| * `{{name}}` |
| |
| |
| In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashicorp.com/terraform/language/import) to import Instance using one of the formats above. For example: |
| |
| ```tf |
| import { |
| id = "projects/{{project}}/locations/{{region}}/instances/{{name}}" |
| to = google_memcache_instance.default |
| } |
| ``` |
| |
| When using the [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import), 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}} |
| ``` |
| |
| ## User Project Overrides |
| |
| This resource supports [User Project Overrides](https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/provider_reference#user_project_override). |