@@ -172,6 +172,98 @@ resource "rediscloud_active_active_private_service_connect_endpoint_accepter" "a
172172
173173```
174174
175+ ## Example Usage with Redis Private Service Connect Module
176+
177+ The example below creates a Private Service Connect Endpoint in an Active-Active subscription using a Terraform module.
178+ We recommend using the module as it simplifies the Terraform configuration.
179+
180+ ``` hcl
181+ data "rediscloud_payment_method" "card" {
182+ card_type = "Visa"
183+ }
184+
185+ resource "rediscloud_active_active_subscription" "subscription" {
186+ name = "subscription-name"
187+ payment_method_id = data.rediscloud_payment_method.card.id
188+ cloud_provider = "GCP"
189+
190+ creation_plan {
191+ memory_limit_in_gb = 1
192+ quantity = 1
193+ region {
194+ region = "us-central1"
195+ networking_deployment_cidr = "192.168.0.0/24"
196+ write_operations_per_second = 1000
197+ read_operations_per_second = 1000
198+ }
199+ region {
200+ region = "europe-west1"
201+ networking_deployment_cidr = "10.0.1.0/24"
202+ write_operations_per_second = 1000
203+ read_operations_per_second = 1000
204+ }
205+ }
206+ }
207+
208+ resource "rediscloud_active_active_subscription_database" "database" {
209+ subscription_id = rediscloud_active_active_subscription.subscription.id
210+ name = "db"
211+ memory_limit_in_gb = 1
212+ global_data_persistence = "aof-every-1-second"
213+ global_password = "some-password"
214+ }
215+
216+ resource "rediscloud_active_active_subscription_regions" "regions" {
217+ subscription_id = rediscloud_active_active_subscription.subscription.id
218+
219+ region {
220+ region = "us-central1"
221+ networking_deployment_cidr = "192.168.0.0/24"
222+ database {
223+ database_id = rediscloud_active_active_subscription_database.database.db_id
224+ database_name = rediscloud_active_active_subscription_database.database.name
225+ local_write_operations_per_second = 1000
226+ local_read_operations_per_second = 1000
227+ }
228+ }
229+
230+ region {
231+ region = "europe-west1"
232+ networking_deployment_cidr = "10.0.1.0/24"
233+ database {
234+ database_id = rediscloud_active_active_subscription_database.database.db_id
235+ database_name = rediscloud_active_active_subscription_database.database.name
236+ local_write_operations_per_second = 1000
237+ local_read_operations_per_second = 1000
238+ }
239+ }
240+ }
241+
242+ locals {
243+ region_id = one([for r in rediscloud_active_active_subscription_regions.regions.region : r.region_id if r.region == var.gcp_region])
244+ }
245+
246+ module "private_service_connect" {
247+ source = "RedisLabs/private-service-connect/rediscloud"
248+
249+ rediscloud_subscription_type = "active-active"
250+ rediscloud_subscription_id = rediscloud_active_active_subscription.subscription.id
251+ rediscloud_region_id = local.region_id
252+
253+ gcp_region = var.gcp_region
254+
255+ endpoints = [
256+ {
257+ gcp_project_id = var.gcp_project_id
258+ gcp_vpc_name = var.gcp_vpc_name
259+ gcp_vpc_subnetwork_name = var.gcp_subnet_name
260+ gcp_response_policy_name = var.gcp_response_policy_name
261+ }
262+ ]
263+ }
264+
265+ ```
266+
175267## Argument Reference
176268
177269* ` subscription_id ` - (Required) The ID of the Pro subscription to attach ** Modifying this attribute will force creation of a new resource.**
0 commit comments