Code Monkey home page Code Monkey logo

terraform-google-sql-db's Introduction

terraform-google-sql

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 more details.

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:

for instance in 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:

  • Perform bundle install command
    • Installs test-kitchen, kitchen-terraform and kitchen-inspec
  • Perform bundle exec kitchen create command
    • Performs terraform init
  • Perform bundle exec kitchen converge command
    • Performs terraform apply -auto-approve
  • Perform bundle exec kitchen verify command
    • Performs inspec tests
  • Perform bundle exec kitchen destroy command
    • Performs terraform 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 shellcheck
Running flake8
Running go fmt and go vet
Running terraform validate
Running terraform fmt
Running hadolint on Dockerfiles
Checking for required files
The following lines have trailing whitespace
Generating markdown docs with terraform-docs

The linters are as follows:

  • Shell - shellcheck. Can be found in homebrew
  • Python - flake8. Can be installed with pip 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 the terraform validate command.
  • Dockerfiles - hadolint. Can be found in homebrew

terraform-google-sql-db's People

Contributors

namusyaka avatar danisla avatar morgante avatar tpoindessous avatar danawillow avatar

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.