diff --git a/modules/postgresql/README.md b/modules/postgresql/README.md index b9908f5..bd70733 100644 --- a/modules/postgresql/README.md +++ b/modules/postgresql/README.md @@ -37,7 +37,7 @@ | [auth](#input\_auth) | (Optional) The authentication for a private docker registry.

auth = {
server\_address = The address of the server for the authentication against a private docker registry.
username = The password.
password = The username.
} |
object({
server_address = optional(string)
username = string
password = string
})
| `null` | no | | [constraints](#input\_constraints) | (Optional) The container placement constraints | `set(string)` | `[]` | no | | [custom\_image](#input\_custom\_image) | The docker image name excluding the image tag | `string` | `null` | no | -| [custom\_postgresql\_password](#input\_custom\_postgresql\_password) | Used to overwrite the generated redis password | `string` | n/a | yes | +| [custom\_postgresql\_password](#input\_custom\_postgresql\_password) | A custom password for postgresql which will be used over the generated one. | `string` | `null` | no | | [env](#input\_env) | (Optional) The environmental variables to pass to the docker image | `map(string)` | `null` | no | | [healthcheck](#input\_healthcheck) | healthcheck = {
test = The test to be performed in CMD format.
interval = Time between running the check (ms\|s\|m\|h). Defaults to '0s'.
timeout = Maximum time to allow one check to run (ms\|s\|m\|h). Defaults to '0s'.
retries = Consecutive failures needed to report unhealthy. Defaults to '0'.
start\_period = Start period for the container to initialize before counting retries towards unstable (ms\|s\|m\|h). Defaults to '0s'.
} |
object({
test = list(string)
interval = optional(string, "0s")
timeout = optional(string, "0s")
retries = optional(number, 0)
start_period = optional(string, "0s")
})
| `null` | no | | [image\_tag](#input\_image\_tag) | (Optional) The image tag of the docker image. Defaults to: latest | `string` | `"latest"` | no | diff --git a/modules/postgresql/main.tf b/modules/postgresql/main.tf index 31c6fca..813f8f6 100644 --- a/modules/postgresql/main.tf +++ b/modules/postgresql/main.tf @@ -4,7 +4,7 @@ locals { image = coalesce(var.custom_image, "postgres") # https://hub.docker.com/_/postgres image_tag = coalesce(var.image_tag, "16.2-alpine") - database_password = var.custom_postgresql_password == null ? nonsensitive(random_password.postgres_password.result) : var.custom_postgresql_password + database_password = coalesce(var.custom_postgresql_password, nonsensitive(random_password.postgres_password.result)) this_postgresql_config_file = "/etc/postgresql/postgresql.conf" diff --git a/modules/postgresql/variables.tf b/modules/postgresql/variables.tf index 03b9456..d08d77d 100644 --- a/modules/postgresql/variables.tf +++ b/modules/postgresql/variables.tf @@ -320,4 +320,5 @@ variable "custom_postgresql_password" { type = string description = "A custom password for postgresql which will be used over the generated one." nullable = true -} \ No newline at end of file + default = null +}