Giter VIP home page Giter VIP logo

terraform-google-sql's Introduction

SQL Terraform module

Terraform module which creates SQL resources, secrets and backups on GCP. This module uses the sql-db module by GoogleCloudPlatform.

User Stories for this module

  • 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

Usage

Databases

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.

SQL Exporter

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.

โš ๏ธ Althought we do not recommend creating different databases in the same instance, simultaneous backups for databases in the same instance. If you are in this situation, please be careful to schedule backups for your databases apart from each other to avoid failed backups.

Examples

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.

License

License

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.

terraform-google-sql's People

Contributors

alan-pad avatar callumhemsley avatar edix9 avatar github-actions[bot] avatar padok-enabler-github-app[bot] avatar pviossat avatar renovate[bot] avatar smeelock avatar spoukke avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

terraform-google-sql's Issues

Variables naming

I was wondering why did you call the variables additina_users and additional_databases since they are the only way in the interface to create users and databases? I think they should simply called users and databases

append random suffix to the db name

Currently the instance name is determinist. we should add a random_suffix appended to it. Indeed, if we delete a database instance, the name is still reserved for a month (not a 100% sure about this timeline). Therefore, if you delete/recreate the instanex, it will not work, the use of the randome suffix prevents this issue

Use of secret manager

Currently, we can add to the users' passwords inside the secret manager. I t would be nice to be able select if we want the password or the connection string.

Module does not export secret details

The module does not export the secrets.
Therefore it's impossible to export it's ID to grant reader authorization on it to other resources (a cloudfunction serviceaccount for example)

module is not applicable because some data does not use `project`

In the postgresql module (probably the same in mysql) the data "google_compute_zones" does not use project_id. Therefore, if the provider of a layer does not use project, the apply will not work. Since project_id is already a requierment of the module, it should be used in this data

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/release-please.yaml
  • google-github-actions/release-please-action v3
.github/workflows/terraform-quality.yml
  • padok-team/github-workflows v1
  • padok-team/github-workflows v1
  • padok-team/github-workflows v1
  • padok-team/github-workflows v1
  • padok-team/github-workflows v1
gomod
modules/sql-exporter/function/go.mod
  • go 1.18
  • golang.org/x/oauth2 v0.10.0
  • google.golang.org/api v0.134.0
npm
package.json
terraform
modules/encryption/versions.tf
  • google ~> 4.4
  • google-beta ~> 4.4
  • random ~> 3.0
  • hashicorp/terraform ~> 1.3
modules/mysql/encryption.tf
modules/mysql/mysql.tf
  • GoogleCloudPlatform/sql-db/google 14.1.0
modules/mysql/secrets.tf
modules/mysql/versions.tf
  • google ~> 4.4
  • random ~> 3
  • hashicorp/terraform ~> 1.3
modules/postgresql/encryption.tf
modules/postgresql/postgresql.tf
  • GoogleCloudPlatform/sql-db/google 14.1.0
modules/postgresql/secrets.tf
modules/postgresql/versions.tf
  • google ~> 4.4
  • random ~> 3
  • hashicorp/terraform ~> 1.3
modules/secrets/versions.tf
  • google ~> 4.4
  • random ~> 3
  • hashicorp/terraform >= 1.0.0
modules/sql-exporter/main.tf
  • terraform-google-modules/event-function/google ~> 3.0.0
  • terraform-google-modules/pubsub/google ~> 5.0.0
modules/sql-exporter/versions.tf
  • google ~> 4.11
  • random ~> 3
  • hashicorp/terraform ~> 1.3

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.