Terraform module which creates SQL resources, secrets and backups on GCP. This module uses the sql-db module by GoogleCloudPlatform.
- AASQL / POSTGRES INSTANCE I can be highly available or single zone
- AASQL / POSTGRES INSTANCE I can be fully private or have a public ip
- AASQL / POSTGRES INSTANCE I can have db users and store their passwords in secret manager
- AASQL / POSTGRES INSTANCE I can have multiple dbs
- AASQL / POSTGRES INSTANCE I can have custom exporter to schedule backups in a bucket
- AASQL / POSTGRES INSTANCE I use can use custom managed keys to encrypt my disk
- AASQL / POSTGRES INSTANCE I use execute a custom sql script on deployment
You can use either mysql or postgresql module to create databases instances in GCP. These modules optionnally include secrets module to create secrets in google secret manager with password values for each user.
This module creates a storage bucket and a cloud function to export database backups in buckets. In order to schedule backups on a regular basis, you need to create a cloud scheduler outside of the sql exporter module. In mysql and postgresql modules, you can optionnally enable and configure these schedulers for each databases.
Examples can be found in the examples folder. You might need to run terraform apply
twice because of a race condition with the network. This would not be needed in normal configurations as the network would be created somewhere else.
- MySQL instance private and zonal
- MySQL instance public and regional
- MySQL instance public, zonal, with backup exporter
- POSTGRES instance private and regional
- POSTGRES instance public and zonal
- POSTGRES instance public, regional, with backup
See LICENSE for full details.
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you 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
https://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.