From 9d5df771a36a89d691bce3893135c9322cf51532 Mon Sep 17 00:00:00 2001 From: Lorenzo Caggioni Date: Wed, 13 Apr 2022 14:42:11 +0200 Subject: [PATCH] Update README --- .../cloudsql-multiregion/README.md | 21 +++++++++++++++++-- .../cloudsql-multiregion/outputs.tf | 6 +++--- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/examples/data-solutions/cloudsql-multiregion/README.md b/examples/data-solutions/cloudsql-multiregion/README.md index be44ff8f..8c2c05b9 100644 --- a/examples/data-solutions/cloudsql-multiregion/README.md +++ b/examples/data-solutions/cloudsql-multiregion/README.md @@ -32,13 +32,30 @@ $ terraform apply You should see the output of the Terraform script with resources created and some commands that you'll need in the following steps below. -TBC - ## Move to real use case consideration This implementation is intentionally minimal and easy to read. A real world use case should consider: - Using a Shared VPC - Using VPC-SC to mitigate data exfiltration + +## Test your environment +We assume all those steps are run using a user listed on `data_eng_principals`. You can authenticate as the user using the following command: + +``` +$ gcloud init +$ gcloud auth application-default login +``` + +Below you can find commands to connect to the VM instance and Cloud SQL instance. + +``` + $ gcloud compute ssh sql-test --project PROJECT_ID --zone ZONE + sql-test:~$ cloud_sql_proxy -instances=CLOUDSQL_INSTANCE=tcp:5432 + sql-test:~$ psql 'host=127.0.0.1 port=5432 sslmode=disable dbname=DATABASE user=USER' +``` + +You can find computed commands on the Terraform `demo_commands` output. + ## Variables diff --git a/examples/data-solutions/cloudsql-multiregion/outputs.tf b/examples/data-solutions/cloudsql-multiregion/outputs.tf index fb945ab5..50852670 100644 --- a/examples/data-solutions/cloudsql-multiregion/outputs.tf +++ b/examples/data-solutions/cloudsql-multiregion/outputs.tf @@ -32,8 +32,8 @@ output "project_id" { output "demo_commands" { description = "Demo commands." value = { - 01 = "gcloud compute ssh ${module.test-vm.instance.name} --project ${module.project.name} --zone ${var.regions.primary}-b" - 02 = "cloud_sql_proxy -instances=${module.db.connection_name}=tcp:5432 &" - 03 = "psql 'host=127.0.0.1 port=5432 sslmode=disable dbname=${var.postgres_database} user=postgres'" + "01_ssh" = "gcloud compute ssh ${module.test-vm.instance.name} --project ${module.project.name} --zone ${var.regions.primary}-b" + "02_cloud_sql_proxy" = "cloud_sql_proxy -instances=${module.db.connection_name}=tcp:5432 &" + "03_psql" = "psql 'host=127.0.0.1 port=5432 sslmode=disable dbname=${var.postgres_database} user=postgres'" } }