Skip to content

A simple terraform module to deploy a managed PostgreSQL database on GCP

License

Notifications You must be signed in to change notification settings

sengo4hd/gcp-postgresql-tfmod

Repository files navigation

gcp-postgresql-tfmod

/!\ This module is not production ready, and only a showcase for terraform

A simple terraform module to deploy a Cloud SQL PostgreSQL instance on GCP.

GCP services used are:

  • Cloud SQL

This repository tries to follow the best practices defined by Google.

This repository uses pre-commit hooks.

Possible improvements

  • Enable the tfsec hook and add the checkov hook
  • Support user auth using IAM
  • Store generated passwords in secret manager
  • If possible do not store passwords in the state: follow this issue
  • Support backups, replicas, TLS, private network, reserved public IP

Requirements

Name Version
terraform >= 1.2.6
google 4.31.0

Providers

Name Version
google 4.31.0
random 3.3.2

Modules

No modules.

Resources

Name Type
google_sql_database.instance_databases resource
google_sql_database_instance.this resource
google_sql_user.instance_users resource
random_password.user_passwords resource

Inputs

Name Description Type Default Required
gcp_project The GCP project id in which the Cloud SQL instance will be deployed string "" no
gcp_region The GCP region in which the Cloud SQL instance will be deployed string "" no
instance_databases A list of database to create. WARNING: user permissions are not managed. list(string) [] no
instance_name The name of the Cloud SQL instance string n/a yes
instance_tier The Cloud SQL instance tier to configure the underlying VM resources string "db-f1-micro" no
instance_users A list of users to create. Password are generated by Terraform. WARNING: user permissions are not managed. list(string) [] no
instance_version The Cloud SQL version string for the instance string "POSTGRES_14" no

Outputs

Name Description
instance_public_ip_address The first public (PRIMARY) IPv4 address assigned to the Cloud SQL instance

About

A simple terraform module to deploy a managed PostgreSQL database on GCP

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages