From 7bc5e4e9e71a187507d7e61ea48b6ed9e5d6efee Mon Sep 17 00:00:00 2001 From: Petri Autero Date: Fri, 1 Feb 2019 12:30:23 +0200 Subject: [PATCH] Documentation updates --- modules/cloud-sql/README.md | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/modules/cloud-sql/README.md b/modules/cloud-sql/README.md index eb8bfed..7686730 100644 --- a/modules/cloud-sql/README.md +++ b/modules/cloud-sql/README.md @@ -9,24 +9,38 @@ You can use Cloud SQL with either [MySQL](https://cloud.google.com/sql/docs/mysq See the [examples](/examples) folder for an example. +## How do you configure this module? + +This module allows you to configure a number of parameters, such as backup windows, maintenance window, replicas +and encryption. For a list of all available variables and their descriptions, see [variables.tf](./variables.tf). + ## How do you connect to the database? +**Cloud SQL instances are created in a producer network (a VPC network internal to Google). They are not created in your VPC network.** + +You can use both [public IP](https://cloud.google.com/sql/docs/mysql/connect-admin-ip) and [private IP](https://cloud.google.com/sql/docs/mysql/private-ip) to connect to a Cloud SQL instance. +Neither connection method affects the other; you must protect the public IP connection whether the instance is configured to use private IP or not. + +You can also use the [Cloud SQL Proxy](https://cloud.google.com/sql/docs/mysql/connect-admin-proxy) to connect to an instance that is also configured to use private IP. The proxy can connect using either the private IP address or a public IP address. + This module provides the connection details as [Terraform output variables](https://www.terraform.io/intro/getting-started/outputs.html): -1. **Cluster endpoint**: The endpoint for the whole cluster. You should always use this URL for writes, as it points to - the primary. -1. **Instance endpoints**: A comma-separated list of all DB instance URLs in the cluster, including the primary and all +**TODO**: Connectivity and outputs below + + +1. **Public IP** `private_ip`: The public endpoint for the cluster. +1. **Public IP** `public_ip`: The public endpoint for the cluster. +1. **Connection name** `connection_name`: The private endpoint for the cluster. +1. **Replica endpoints** `replica_endpoints`: A comma-separated list of all DB instance URLs in the cluster, including the primary and all read replicas. Use these URLs for reads (see "How do you scale this DB?" below). -1. **Port**: The port to use to connect to the endpoints above. -TODO: Connectivity and output -For more info, see [Connecting to Cloud SQL from External Applications](https://cloud.google.com/sql/docs/mysql/connect-external-app). -You can programmatically extract these variables in your Terraform templates and pass them to other resources (e.g. -pass them to User Data in your EC2 instances). You'll also see the variables at the end of each `terraform apply` call -or if you run `terraform output`. +You can programmatically extract these variables in your Terraform templates and pass them to other resources. +You'll also see the variables at the end of each `terraform apply` call or if you run `terraform output`. + +For full connectivity options and detailed documentation, see [Connecting to Cloud SQL from External Applications](https://cloud.google.com/sql/docs/mysql/connect-external-app). ## How do you scale this database? @@ -37,11 +51,6 @@ or if you run `terraform output`. and Aurora will automatically deploy the new instances, sync them to the master, and make them available as read replicas. -## How do you configure this module? - -This module allows you to configure a number of parameters, such as backup windows, maintenance window, port number, -and encryption. For a list of all available variables and their descriptions, see [variables.tf](./variables.tf). - ## Known Issues ### Instance Recovery