Skip to content

Commit

Permalink
Memorystore Redis connectMode support (#3246)
Browse files Browse the repository at this point in the history
* Memorystore Redis connectMode support

* Redis connectMode explicit default
  • Loading branch information
drebes authored Mar 13, 2020
1 parent 30dd013 commit febafc8
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 0 deletions.
11 changes: 11 additions & 0 deletions products/redis/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,17 @@ objects:
instance is connected. If left unspecified, the default network
will be used.
input: true
- !ruby/object:Api::Type::Enum
name: connectMode
description: |
The connection mode of the Redis instance. Can be either
`DIRECT_PEERING` or `PRIVATE_SERVICE_ACCESS`. The default
connect mode if not provided is `DIRECT_PEERING`.
input: true
values:
- :DIRECT_PEERING
- :PRIVATE_SERVICE_ACCESS
default_value: :DIRECT_PEERING
- !ruby/object:Api::Type::Time
name: createTime
description: |
Expand Down
3 changes: 3 additions & 0 deletions products/redis/terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ overrides: !ruby/object:Overrides::ResourceOverrides
network_name: "redis-test-network"
test_vars_overrides:
network_name: 'BootstrapSharedTestNetwork(t, "redis-full")'
- !ruby/object:Provider::Terraform::Examples
name: "redis_instance_private_service"
primary_resource_id: "cache"
properties:
alternativeLocationId: !ruby/object:Overrides::Terraform::PropertyOverride
default_from_api: true
Expand Down
35 changes: 35 additions & 0 deletions templates/terraform/examples/redis_instance_private_service.tf.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
resource "google_compute_network" "network" {
name = "tf-test%{random_suffix}"
}

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

resource "google_service_networking_connection" "private_service_connection" {
network = google_compute_network.network.self_link
service = "servicenetworking.googleapis.com"
reserved_peering_ranges = [google_compute_global_address.service_range.name]
}

resource "google_redis_instance" "<%= ctx[:primary_resource_id] %>" {
name = "tf-test%{random_suffix}"
tier = "STANDARD_HA"
memory_size_gb = 1

location_id = "us-central1-a"
alternative_location_id = "us-central1-f"

authorized_network = google_compute_network.network.self_link
connect_mode = "PRIVATE_SERVICE_ACCESS"

redis_version = "REDIS_3_2"
display_name = "Terraform Test Instance"

depends_on = [ google_service_networking_connection.private_service_connection ]

}

0 comments on commit febafc8

Please sign in to comment.