README.md

June 10, 2026 ยท View on GitHub

Description

terraform-google-sql makes it easy to create a Google CloudSQL instance and implement high availability settings. This module is meant for use with Terraform 0.13+ and tested using Terraform 1.0+.

The cloudsql created here is used to integrate with the slurm cluster to enable accounting data storage.

Example

- id: cloudsql
  source: community/modules/database/slurm-cloudsql-federation
  use: [network]
  settings:
    sql_instance_name: slurm-sql6-demo
    tier: "db-f1-micro"

This creates a cloud sql instance, including a database, user that would allow the slurm cluster to use as an external DB. In addition, it will allow BigQuery to run federated query through it.

License

Copyright 2026 Google LLC

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Requirements

NameVersion
terraform>= 1.12.2
google>= 3.83
random~> 3.0

Providers

NameVersion
google>= 3.83
random~> 3.0

Modules

No modules.

Resources

NameType
google_bigquery_connection.connectionresource
google_compute_address.pscresource
google_compute_forwarding_rule.psc_consumerresource
google_sql_database.databaseresource
google_sql_database_instance.instanceresource
google_sql_user.usersresource
random_id.resource_name_suffixresource
random_password.passwordresource

Inputs

NameDescriptionTypeDefaultRequired
authorized_networksIP address ranges as authorized networks of the Cloud SQL for MySQL instanceslist(string)[]no
data_cache_enabledWhether data cache is enabled for the instance. Can be used with ENTERPRISE_PLUS edition.boolfalseno
database_flagsDatabase flags to set on instance.map(string){}no
database_versionThe version of the database to be created.string"MYSQL_8_0"no
deletion_protectionWhether or not to allow Terraform to destroy the instance.stringfalseno
deployment_nameThe name of the current deploymentstringn/ayes
disk_autoresizeSet to false to disable automatic disk grow.booltrueno
disk_size_gbSize of the database disk in GiB.numbernullno
editionvaluestring"ENTERPRISE"no
enable_backupsSet true to enable backupsboolfalseno
labelsLabels to add to the instances. Key-value pairs.map(string)n/ayes
network_idThe ID of the GCE VPC network to which the instance is going to be created in.:
projects/<project_id>/global/networks/<network_name>"
stringn/ayes
private_vpc_connection_peeringThe name of the VPC Network peering connection, used only as dependency for Cloud SQL creation.stringnullno
project_idProject in which the HPC deployment will be createdstringn/ayes
query_insightsQuery insights configuration.
object({
enabled = optional(bool, false)
query_plans_per_minute = optional(number)
query_string_length = optional(number)
record_application_tags = optional(bool)
record_client_address = optional(bool)
})
{}no
regionThe region where SQL instance will be configuredstringn/ayes
sql_instance_namename given to the sql instance for ease of identificaionstringn/ayes
sql_passwordPassword for the SQL database.anynullno
sql_usernameUsername for the SQL databasestring"slurm"no
subnetwork_self_linkSelf link of the network where Cloud SQL instance PSC endpoint will be createdstringnullno
tierThe machine type to use for the SQL instancestringn/ayes
use_psc_connectionCreate Private Service Connection instead of using Private Service Access peeringboolfalseno
user_managed_replicationReplication parameters that will be used for defined secrets
list(object({
location = string
kms_key_name = optional(string)
}))
[]no

Outputs

NameDescription
cloudsqlDescribes the cloudsql instance.