Google Cloud SQL Database

This page shows how to write Terraform for Cloud SQL Database and write them securely.

google_sql_database (Terraform)

The Database in Cloud SQL can be configured in Terraform with the resource name google_sql_database. The following sections describe 1 example of how to use the resource and its parameters.

Example Usage from GitHub
resource "google_sql_database" "database" {
  name     = "mysql_correa_integrationtest_db"
  instance =

resource "google_sql_database" "database2" {


Explanation in Terraform Registry

Represents a SQL database inside the Cloud SQL instance, hosted in Google's cloud.

Frequently asked questions

What is Google Cloud SQL Database?

Google Cloud SQL Database is a resource for Cloud SQL of Google Cloud Platform. Settings can be wrote in Terraform.

Where can I find the example code for the Google Cloud SQL Database?

For Terraform, the ronaldofc/db-terraform source code example is useful. See the Terraform Example section for further details.


Scan your IaC problem in 3 minutes for free

You can keep your IaC security for free. No credit card required.