Skip to content

Commit

Permalink
feat: INFRA-403 add var postgres_data for more flexibility
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastienbonami committed Aug 4, 2023
1 parent bee879d commit 67d500a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ The module takes the following variables as input:
- **extra_security_group_ids**: List of extra security groups to assign beyond those already assigned by the module. Defaults to `[]`
- **postgres_image**: Docker image to launch the postgres container with
- **postgres_params**: Additional command line parameters to pass to postgres when launching it
- **postgres_data**: Path where to store the configuration and data files
- **postgres_user**: User that will be used to access the database
- **postgres_database**: Name of the database that will be accessed
- **postgres_password**: Password that will be used to access the database. If omitted, a random password is generated
Expand Down Expand Up @@ -117,6 +118,7 @@ To safeguard against potential outages and loss of data, changes to the server's
To reprovision a new instance with changes to the following parameters, the module should be explicitly deleted and re-created:
- postgres_image
- postgres_params
- postgres_data
- postgres_user
- postgres_password
- postgres_database
1 change: 1 addition & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ data "template_cloudinit_config" "postgres_config" {
{
image = var.postgres_image
params = local.postgres_params
data = var.postgres_data
user = var.postgres_user
password = local.postgres_password
database = var.postgres_database
Expand Down
2 changes: 1 addition & 1 deletion templates/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ services:
command: ${params}
%{ endif ~}
environment:
PGDATA: /data
PGDATA: "${data}"
POSTGRES_USER: "${user}"
POSTGRES_PASSWORD: "${password}"
POSTGRES_DB: "${database}"
6 changes: 6 additions & 0 deletions variable.tf
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ variable "postgres_params" {
default = ""
}

variable "postgres_data" {
description = "Path where to store the configuration and data files"
type = string
default = "/data"
}

variable "postgres_user" {
description = "User that will access the database"
type = string
Expand Down

0 comments on commit 67d500a

Please sign in to comment.