...

Text file src/github.com/GoogleCloudPlatform/k8s-config-connector/scripts/resource-autogen/generated/samples/Memcache-MemcacheInstance-memcache_instance_basic/main.tf

Documentation: github.com/GoogleCloudPlatform/k8s-config-connector/scripts/resource-autogen/generated/samples/Memcache-MemcacheInstance-memcache_instance_basic

     1/**
     2 * Copyright 2022 Google LLC
     3 *
     4 * Licensed under the Apache License, Version 2.0 (the "License");
     5 * you may not use this file except in compliance with the License.
     6 * You may obtain a copy of the License at
     7 *
     8 *      http://www.apache.org/licenses/LICENSE-2.0
     9 *
    10 * Unless required by applicable law or agreed to in writing, software
    11 * distributed under the License is distributed on an "AS IS" BASIS,
    12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13 * See the License for the specific language governing permissions and
    14 * limitations under the License.
    15 */
    16
    17```hcl
    18// This example assumes this network already exists.
    19// The API creates a tenant network per network authorized for a
    20// Memcache instance and that network is not deleted when the user-created
    21// network (authorized_network) is deleted, so this prevents issues
    22// with tenant network quota.
    23// If this network hasn't been created and you are using this example in your
    24// config, add an additional network resource or change
    25// this from "data"to "resource"
    26data "google_compute_network" "memcache_network" {
    27  name = "test-network"
    28}
    29
    30resource "google_compute_global_address" "service_range" {
    31  name          = "address"
    32  purpose       = "VPC_PEERING"
    33  address_type  = "INTERNAL"
    34  prefix_length = 16
    35  network       = data.google_compute_network.memcache_network.id
    36}
    37
    38resource "google_service_networking_connection" "private_service_connection" {
    39  network                 = data.google_compute_network.memcache_network.id
    40  service                 = "servicenetworking.googleapis.com"
    41  reserved_peering_ranges = [google_compute_global_address.service_range.name]
    42}
    43
    44resource "google_memcache_instance" "instance" {
    45  name = "test-instance"
    46  authorized_network = google_service_networking_connection.private_service_connection.network
    47
    48  node_config {
    49    cpu_count      = 1
    50    memory_size_mb = 1024
    51  }
    52  node_count = 1
    53  memcache_version = "MEMCACHE_1_5"
    54
    55  maintenance_policy {
    56    weekly_maintenance_window {
    57      day      = "SATURDAY"
    58      duration = "14400s"
    59      start_time {
    60        hours = 0
    61        minutes = 30
    62        seconds = 0
    63        nanos = 0
    64      }
    65    }
    66  }
    67}
    68```

View as plain text