https://github.com/konpyutaika/terraform-gcp-cloud-sql
Terraform module to deploy GCP Cloud SQL
https://github.com/konpyutaika/terraform-gcp-cloud-sql
cloud-sql gcp terraform
Last synced: 7 months ago
JSON representation
Terraform module to deploy GCP Cloud SQL
- Host: GitHub
- URL: https://github.com/konpyutaika/terraform-gcp-cloud-sql
- Owner: konpyutaika
- License: apache-2.0
- Created: 2022-09-24T21:14:42.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-09-24T21:38:15.000Z (over 3 years ago)
- Last Synced: 2025-06-07T16:14:14.883Z (8 months ago)
- Topics: cloud-sql, gcp, terraform
- Language: HCL
- Homepage:
- Size: 10.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.MD
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
## Requirements
| Name | Version |
|------|---------|
| [terraform](#requirement\_terraform) | >=0.15 |
| [google](#requirement\_google) | >= 3.89.0 |
| [random](#requirement\_random) | >= 3.1.0 |
| [vault](#requirement\_vault) | >= 2.17.0 |
## Providers
| Name | Version |
|------|---------|
| [google](#provider\_google) | >= 3.89.0 |
| [google-beta](#provider\_google-beta) | n/a |
| [random](#provider\_random) | >= 3.1.0 |
## Modules
No modules.
## Resources
| Name | Type |
|------|------|
| [google-beta_google_secret_manager_secret.registry_sql_client_cert](https://registry.terraform.io/providers/hashicorp/google-beta/latest/docs/resources/google_secret_manager_secret) | resource |
| [google-beta_google_secret_manager_secret.registry_sql_user_password](https://registry.terraform.io/providers/hashicorp/google-beta/latest/docs/resources/google_secret_manager_secret) | resource |
| [google-beta_google_secret_manager_secret_version.registry_sql_client_cert](https://registry.terraform.io/providers/hashicorp/google-beta/latest/docs/resources/google_secret_manager_secret_version) | resource |
| [google-beta_google_secret_manager_secret_version.secret-version-basic](https://registry.terraform.io/providers/hashicorp/google-beta/latest/docs/resources/google_secret_manager_secret_version) | resource |
| [google_sql_database.cloudsql_database](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/sql_database) | resource |
| [google_sql_database_instance.cloudsql_instance](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/sql_database_instance) | resource |
| [google_sql_ssl_cert.client_cert](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/sql_ssl_cert) | resource |
| [google_sql_user.cloudsql_user](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/sql_user) | resource |
| [random_password.cloudsql_user_password](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/password) | resource |
## Inputs
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| [authorized\_cidrs](#input\_authorized\_cidrs) | Authorized networks CIDRs to connect to Cloud SQL instance. | `map(string)` | `{}` | no |
| [backup\_configuration](#input\_backup\_configuration) | The backup\_configuration subblock for the database setings |
list(object({
enabled = bool
start_time = string
location = string
retained_backups = number
})) | `[]` | no |
| [cert\_common\_name](#input\_cert\_common\_name) | Certificate Common Name. | `string` | n/a | yes |
| [database\_version](#input\_database\_version) | Database type and version. Supported values = {MYSQL\_5\_6, MYSQL\_5\_7, MYSQL\_8\_0, POSTGRES\_9\_6,POSTGRES\_10, POSTGRES\_11, POSTGRES\_12, POSTGRES\_13, ...}. See {Instance settings documentation} | `string` | n/a | yes |
| [db\_name](#input\_db\_name) | Full name of the SQL database. | `string` | n/a | yes |
| [deletion\_protection](#input\_deletion\_protection) | If set to true, you protect an instance from being deleted. | `bool` | `true` | no |
| [disk\_autoresize](#input\_disk\_autoresize) | Whether if the disk can grow when more space is needed. If disk\_autoresize=true do not set disk\_size as terraform apply would try to set the disk\_size | `bool` | `true` | no |
| [disk\_type](#input\_disk\_type) | Type of disk used on the CloudSQL instance VM | `string` | `"PD_SSD"` | no |
| [instance\_name](#input\_instance\_name) | Full name of the SQL instance. | `string` | n/a | yes |
| [maintenance\_window](#input\_maintenance\_window) | Maintenance window to update/patch the VM. It can be rebooted during this maintenance window | list(object({
day = number
hour = number
update_track = string
})) | `[]` | no |
| [module\_depends\_on](#input\_module\_depends\_on) | n/a | `any` | `null` | no |
| [network](#input\_network) | Self link of the VPC network | `string` | n/a | yes |
| [public\_ip](#input\_public\_ip) | assign a public IP to this CloudSQL instance. Attention: you need Security approval to give a public IP to your CloudSQL instance. | `bool` | `false` | no |
| [region](#input\_region) | The region to host the resources in. | `string` | `"europe-west1"` | no |
| [require\_ssl](#input\_require\_ssl) | If require SSL, the connection port will be 3307, otherwise 3306. | `bool` | `true` | no |
| [tier](#input\_tier) | CloudSQL instance machine type (service tier). See {Instance settings documentation} | `string` | n/a | yes |
| [user\_host](#input\_user\_host) | The host the user can connect from. This is only supported for MySQL instances. Don't set this field for PostgreSQL instances. Can be an IP address, or % to allow any host. Changing this forces a new resource to be created. | `string` | `null` | no |
| [user\_name](#input\_user\_name) | User name. | `string` | n/a | yes |
## Outputs
| Name | Description |
|------|-------------|
| [connection\_name](#output\_connection\_name) | Cloud SQL connection name |
| [database\_name](#output\_database\_name) | Cloud SQL Database name |
| [instance\_connection\_name](#output\_instance\_connection\_name) | The connection name of the instance to be used in connection strings. For example, when connecting with Cloud SQL Proxy. |
| [instance\_ip\_address](#output\_instance\_ip\_address) | The IPv4 address assigned to the database instance. |
| [instance\_ip\_address\_type](#output\_instance\_ip\_address\_type) | The type of IP address assigned to this instance. { PRIMARY \| OUTGOING \| PRIVATE }. This module handles with PRIVATE only |
| [instance\_name](#output\_instance\_name) | Cloud SQL Database instance name |
| [secret\_manager\_cloudsql\_client\_cert\_secret\_id](#output\_secret\_manager\_cloudsql\_client\_cert\_secret\_id) | Secret manager id path where the CloudSQL client certificate secret is stored |
| [secret\_manager\_cloudsql\_user\_secret\_id](#output\_secret\_manager\_cloudsql\_user\_secret\_id) | Secret manager id where the CloudSQL user name/password secret is stored |