...

Text file src/github.com/GoogleCloudPlatform/k8s-config-connector/scripts/resource-autogen/generated/samples/Redis-RedisInstance-redis_instance_cmek-skipped/main.tf

Documentation: github.com/GoogleCloudPlatform/k8s-config-connector/scripts/resource-autogen/generated/samples/Redis-RedisInstance-redis_instance_cmek-skipped

     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
    18resource "google_redis_instance" "cache" {
    19  name           = "cmek-memory-cache"
    20  tier           = "STANDARD_HA"
    21  memory_size_gb = 1
    22
    23  location_id             = "us-central1-a"
    24  alternative_location_id = "us-central1-f"
    25
    26  authorized_network = data.google_compute_network.redis-network.id
    27
    28  redis_version     = "REDIS_6_X"
    29  display_name      = "Terraform Test Instance"
    30  reserved_ip_range = "192.168.0.0/29"
    31
    32  labels = {
    33    my_key    = "my_val"
    34    other_key = "other_val"
    35  }
    36  customer_managed_key = google_kms_crypto_key.redis_key.id
    37}
    38
    39resource "google_kms_key_ring" "redis_keyring" {
    40  name     = "redis-keyring"
    41  location = "us-central1"
    42}
    43
    44resource "google_kms_crypto_key" "redis_key" {
    45  name            = "redis-key"
    46  key_ring        = google_kms_key_ring.redis_keyring.id
    47}
    48
    49// This example assumes this network already exists.
    50// The API creates a tenant network per network authorized for a
    51// Redis instance and that network is not deleted when the user-created
    52// network (authorized_network) is deleted, so this prevents issues
    53// with tenant network quota.
    54// If this network hasn't been created and you are using this example in your
    55// config, add an additional network resource or change
    56// this from "data"to "resource"
    57data "google_compute_network" "redis-network" {
    58  name = "redis-test-network"
    59}
    60```

View as plain text