postgresql

AckeeCZ/postgresql/sql

Terraform Module HCL SQL

Provision GCP Cloud SQL PostgreSQL instance

Install
module "postgresql" {
source = "AckeeCZ/postgresql/sql"
version = "5.12.0"
}
plain text: /constructs/tfmod-ackeecz-postgresql-sql/install.txt
⭐ Source on GitHub 📦 Registry page
README

Terraform Google Cloud SQL Postgres module with K8s secret deploy Terraform module for provisioning GCP SQL Postgres database. It should also deploy the username and password to K8s as a secret. That could be used in setting up cloudsql proxy pod. Usage ``hcl module "postgresql" { source = "AckeeCZ/postgresql/sql" project = "${var.project}" region = "${var.region}" zone = "${var.zone}" namespace = "${var.namespace}" cluster_ca_certificate = "${module.gke.cluster_ca_certificate}" cluster_user = "${module.gke.cluster_username}" cluster_pass = "${module.gke.cluster_password}" cluster_endpoint = "${module.gke.endpoint}" environment = "production" instance_tier = "db-n1-standard-1" # optional, default is db-n1-standard-1 availability_type = "REGIONAL" # REGIONAL for HA setup, ZONAL for single z

Inputs (42)
NameTypeDescriptionDefault
projectstringGCP project name required
vault_secret_pathstringPath to secret in local vault, used mainly to save gke credentials required
regionstringGCP region"europe-west3"
backup_locationstringLocation of backups"eu"
maintenance_window_hourstringThe hour, when maintenance window begins"4"
password_lengthnumberPassword length of postgres users16
provision_kubernetes_resourcesboolShould we provision anything that needs Kubernetes?true
default_dbname_overridestringOverrides default postgres database namenull
environmentstringProject enviroment, e.g. stage, production and development"development"
maintenance_window_daystringThe day, when maintenance window will be performed"7"
sqlproxy_service_account_namestringSQL instance service account namenull
cluster_ca_certificatestringPublic CA certificate that is the root of trust for the GKE K8s clusternull
networkstringGCE VPC used for possible private IP addresses"default"
db_versionstringDatabase version"POSTGRES_11"
query_string_length_insightsnumberInsights maximum query length stored in bytes. Between 256 and 4500. Default to 1024
cloudsql_portnumberCloudSQL's port5432
name_overridestringSets complete CloudSQL instance namenull
zonestringThe preferred compute engine zone"europe-west3-c"
namespacestringK8s namespace to where insert Cloud SQL credentials secrets"production"
cluster_endpointstringCluster control plane endpoint"example.com:8080"
instance_tierstringThe machine type to use"db-custom-1-3840"
private_ipboolIf set to true, private IP address will get allocated and connect it to VPC netwfalse
… and 2 more inputs
Outputs (8)
postgres_reader_instance_ip_settings — PSQL instance IP address settings of read replicas
postgres_postgres_password — PSQL password to postgres user
postgres_default_password — PSQL password to default user
postgres_instance_name — PSQL instance name
instance_name — PSQL instance name
postgres_instance_connection_name — PSQL instance connection name
instance_connection_name — PSQL instance connection name
postgres_instance_ip_settings — PSQL instance IP address settings
Resources (15)
google_compute_global_addressgoogle_project_iam_membergoogle_project_servicegoogle_service_accountgoogle_service_account_keygoogle_service_networking_connectiongoogle_sql_databasegoogle_sql_database_instancegoogle_sql_userkubernetes_endpointskubernetes_secretkubernetes_servicerandom_idrandom_passwordvault_generic_secret
Details
FrameworkTerraform Module
LanguageHCL
Version5.12.0
Cloud SQL
★ Stars6
Forks3
Total downloads9.1k
Inputs42
Outputs8
Resources15
NamespaceAckeeCZ
Updated