Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memorystore Redis connectMode support #3246

Merged
merged 2 commits into from
Mar 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 ]

}