Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Nov 3, 2025. It is now read-only.

Modular Cloud SQL database instance for Terraform.

License

NotificationsYou must be signed in to change notification settings

firehydrant/terraform-google-sql-db

 
 

Repository files navigation

terraform-google-sql makes it easy to create Google CloudSQL instance and implement high availability settings.This module consists of the following submodules:

See more details in each module's README.

Requirements

Installation Dependencies

Configure a Service Account

In order to execute this module you must have a Service Account with the following:

Roles

  • roles/cloudsql.admin

Enable APIs

In order to operate with the Service Account you must activate the following APIs on the project where the Service Account was created:

  • Cloud SQL API

Service Account Credentials

You can pass the service account credentials into this module by setting the following environment variables:

  • GOOGLE_CREDENTIALS
  • GOOGLE_CLOUD_KEYFILE_JSON
  • GCLOUD_KEYFILE_JSON

See moredetails.

Testing

Requirements

Generate docs automatically

$ make generate_docs

Integration Test

The integration tests for this module leverage kitchen-terraform and kitchen-inspec.

You must set up by manually before running the integration test:

forinstancein mysql-simple mysql-ha postgresql-simple postgresql-ha;do  cp"test/fixtures/$instance/terraform.tfvars.example""test/fixtures/$instance/terraform.tfvars"$EDITOR"test/fixtures/$instance/terraform.tfvars"done

And then, you should pass the service account credentials for running inspec by setting the following environment variables:

  • GOOGLE_APPLICATION_CREDENTIALS

The tests will do the following:

  • Performbundle install command
    • Installstest-kitchen,kitchen-terraform andkitchen-inspec
  • Performbundle exec kitchen create command
    • Performsterraform init
  • Performbundle exec kitchen converge command
    • Performsterraform apply -auto-approve
  • Performbundle exec kitchen verify command
    • Performs inspec tests
  • Performbundle exec kitchen destroy command
    • Performsterraform destroy -force

You can use the following command to run the integration test in the root directory.

$ make test_integration

Linting

The makefile in this project will lint or sometimes just format any shell, Python, golang, Terraform, or Dockerfiles. The linters will only be run if the makefile finds files with the appropriate file extension.

All of the linter checks are in the default make target, so you just have to run

$ make -s

The -s is for 'silent'. Successful output looks like this

Running shellcheckRunning flake8Running go fmt and go vetRunning terraform validateRunning terraform fmtRunning hadolint on DockerfilesChecking for required filesThe following lines have trailing whitespaceGenerating markdown docs with terraform-docs

The lintersare as follows:

  • Shell - shellcheck. Can be found in homebrew
  • Python - flake8. Can be installed withpip install flake8
  • Golang - gofmt. gofmt comes with the standard golang installation. golang-s a compiled language so there is no standard linter.
  • Terraform - terraform has a built-in linter in theterraform validate command.
  • Dockerfiles - hadolint. Can be found in homebrew

About

Modular Cloud SQL database instance for Terraform.

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Languages

  • HCL52.0%
  • Ruby23.7%
  • Python18.0%
  • Shell4.1%
  • Makefile2.2%

[8]ページ先頭

©2009-2025 Movatter.jp