Skip to content

Commit

Permalink
fix(postgresql): add custom_postgresql_password default null
Browse files Browse the repository at this point in the history
  • Loading branch information
tafaust committed Jul 6, 2024
1 parent 7203095 commit 843fba3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion modules/postgresql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
| <a name="input_auth"></a> [auth](#input\_auth) | (Optional) The authentication for a private docker registry.<br><br> auth = {<br> server\_address = The address of the server for the authentication against a private docker registry.<br> username = The password.<br> password = The username.<br> } | <pre>object({<br> server_address = optional(string)<br> username = string<br> password = string<br> })</pre> | `null` | no |
| <a name="input_constraints"></a> [constraints](#input\_constraints) | (Optional) The container placement constraints | `set(string)` | `[]` | no |
| <a name="input_custom_image"></a> [custom\_image](#input\_custom\_image) | The docker image name excluding the image tag | `string` | `null` | no |
| <a name="input_custom_postgresql_password"></a> [custom\_postgresql\_password](#input\_custom\_postgresql\_password) | Used to overwrite the generated redis password | `string` | n/a | yes |
| <a name="input_custom_postgresql_password"></a> [custom\_postgresql\_password](#input\_custom\_postgresql\_password) | A custom password for postgresql which will be used over the generated one. | `string` | `null` | no |
| <a name="input_env"></a> [env](#input\_env) | (Optional) The environmental variables to pass to the docker image | `map(string)` | `null` | no |
| <a name="input_healthcheck"></a> [healthcheck](#input\_healthcheck) | healthcheck = {<br> test = The test to be performed in CMD format.<br> interval = Time between running the check (ms\|s\|m\|h). Defaults to '0s'.<br> timeout = Maximum time to allow one check to run (ms\|s\|m\|h). Defaults to '0s'.<br> retries = Consecutive failures needed to report unhealthy. Defaults to '0'.<br> start\_period = Start period for the container to initialize before counting retries towards unstable (ms\|s\|m\|h). Defaults to '0s'.<br> } | <pre>object({<br> test = list(string)<br> interval = optional(string, "0s")<br> timeout = optional(string, "0s")<br> retries = optional(number, 0)<br> start_period = optional(string, "0s")<br> })</pre> | `null` | no |
| <a name="input_image_tag"></a> [image\_tag](#input\_image\_tag) | (Optional) The image tag of the docker image. Defaults to: latest | `string` | `"latest"` | no |
Expand Down
2 changes: 1 addition & 1 deletion modules/postgresql/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
3 changes: 2 additions & 1 deletion modules/postgresql/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
default = null
}

0 comments on commit 843fba3

Please sign in to comment.