Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,13 @@ No modules.
| <a name="input_cluster_name"></a> [cluster\_name](#input\_cluster\_name) | Name of eks cluster | `string` | `""` | no |
| <a name="input_custom_credentials_config"></a> [custom\_credentials\_config](#input\_custom\_credentials\_config) | Specify the configuration settings for Postgresql to pass custom credentials during creation. | `any` | <pre>{<br> "postgres_password": "",<br> "repmgr_password": ""<br>}</pre> | no |
| <a name="input_custom_credentials_enabled"></a> [custom\_credentials\_enabled](#input\_custom\_credentials\_enabled) | Specifies whether to enable custom credentials for PostgreSQL database. | `bool` | `false` | no |
| <a name="input_postgres_password"></a> [postgres\_password](#input\_postgres\_password) | PostgresQL password | `string` | `""` | no |
| <a name="input_postgres_password"></a> [postgres\_password](#input\_postgres\_password) | PostgresQL password | `any` | `""` | no |
| <a name="input_postgresql_config"></a> [postgresql\_config](#input\_postgresql\_config) | Configuration options for the postgresql such as number of replica,chart version, storage class and store password at secret manager. | `map(string)` | <pre>{<br> "environment": "",<br> "name": "",<br> "postgresql_values": "",<br> "replicaCount": 3,<br> "storage_class": "gp2",<br> "store_password_to_secret_manager": true<br>}</pre> | no |
| <a name="input_postgresql_enabled"></a> [postgresql\_enabled](#input\_postgresql\_enabled) | Whether or not to deploy postgresql | `bool` | `true` | no |
| <a name="input_postgresql_exporter_enabled"></a> [postgresql\_exporter\_enabled](#input\_postgresql\_exporter\_enabled) | Whether or not to deploy postgresql exporter | `bool` | `false` | no |
| <a name="input_postgresql_namespace"></a> [postgresql\_namespace](#input\_postgresql\_namespace) | Name of the Kubernetes namespace where the postgresql will be deployed. | `string` | `"postgresql"` | no |
| <a name="input_recovery_window_aws_secret"></a> [recovery\_window\_aws\_secret](#input\_recovery\_window\_aws\_secret) | Number of days that AWS Secrets Manager will wait before deleting a secret. This value can be set to 0 to force immediate deletion, or to a value between 7 and 30 days to allow for recovery. | `number` | `0` | no |
| <a name="input_repmgr_password"></a> [repmgr\_password](#input\_repmgr\_password) | Replication manager password | `string` | `""` | no |
| <a name="input_repmgr_password"></a> [repmgr\_password](#input\_repmgr\_password) | Replication manager password | `any` | `""` | no |

## Outputs

Expand Down
4 changes: 2 additions & 2 deletions examples/complete/aws/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ No requirements.

| Name | Source | Version |
|------|--------|---------|
| <a name="module_aws"></a> [aws](#module\_aws) | git@github.com:sq-ia/terraform-kubernetes-postgresql.git//modules/resources/aws | n/a |
| <a name="module_postgresql"></a> [postgresql](#module\_postgresql) | git@github.com:sq-ia/terraform-kubernetes-postgresql.git | n/a |
| <a name="module_aws"></a> [aws](#module\_aws) | ../../../modules/resources/aws | n/a |
| <a name="module_postgresql"></a> [postgresql](#module\_postgresql) | ../../../ | n/a |

## Resources

Expand Down
10 changes: 7 additions & 3 deletions examples/complete/aws/main.tf
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
locals {
name = "postgresql"
region = "us-east-2"
environment = "prod"
environment = "prodd"
additional_tags = {
Owner = "organization_name"
Expires = "Never"
Department = "Engineering"
}
store_password_to_secret_manager = true
custom_credentials_enabled = false
custom_credentials_enabled = true
custom_credentials_config = {
postgres_password = "60rbJs901a6Oa9hzUM5x7s8Q"
repmgr_password = "IWHLlEYOt25jL4Io7pancB"
Expand All @@ -19,7 +19,7 @@ module "aws" {
source = "git@github.com:sq-ia/terraform-kubernetes-postgresql.git//modules/resources/aws"
name = local.name
environment = local.environment
cluster_name = "cluster-name"
cluster_name = ""
store_password_to_secret_manager = local.store_password_to_secret_manager
custom_credentials_enabled = local.custom_credentials_enabled
custom_credentials_config = local.custom_credentials_config
Expand All @@ -28,6 +28,10 @@ module "aws" {
module "postgresql" {
source = "git@github.com:sq-ia/terraform-kubernetes-postgresql.git"
postgresql_exporter_enabled = true
custom_credentials_enabled = local.custom_credentials_enabled
custom_credentials_config = local.custom_credentials_config
repmgr_password = module.aws.postgresql_credential.repmgr_password
postgres_password = module.aws.postgresql_credential.postgres_password
postgresql_config = {
name = local.name
environment = local.environment
Expand Down
4 changes: 2 additions & 2 deletions modules/resources/aws/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
output "postgresql_credential" {
description = "PostgreSQL credentials used for accessing the database."
value = var.postgresql_config.store_password_to_secret_manager ? null : {
value = {
posgresql_username = "postgres",
postgres_password = var.custom_credentials_enabled ? var.custom_credentials_config.postgres_password : nonsensitive(random_password.postgresql_password[0].result),
repmgr_username = "repmgr",
repmgr_password = var.custom_credentials_enabled ? var.custom_credentials_config.repmgr_password : nonsensitive(random_password.repmgrPassword[0].result),
}
}
}
12 changes: 0 additions & 12 deletions modules/resources/aws/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,3 @@ variable "store_password_to_secret_manager" {
type = bool
default = false
}

variable "postgresql_config" {
description = "Custom credentials configuration."
default = {
name = ""
environment = ""
replicaCount = 3
storage_class = "gp2"
postgresql_values = ""
store_password_to_secret_manager = true
}
}
10 changes: 5 additions & 5 deletions modules/resources/azure/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
output "postgresql_credential" {
description = "PostgreSQL credentials used for accessing the database."
value = var.postgresql_config.store_password_to_secret_manager ? null : {
postgresql_username = "postgres",
postgres_password = var.custom_credentials_enabled ? var.custom_credentials_config.postgres_password : nonsensitive(random_password.postgresql_password[0].result),
repmgr_username = "repmgr",
repmgr_password = var.custom_credentials_enabled ? var.custom_credentials_config.repmgr_password : nonsensitive(random_password.repmgrPassword[0].result),
value = {
posgresql_username = "postgres",
postgres_password = var.custom_credentials_enabled ? var.custom_credentials_config.postgres_password : nonsensitive(random_password.postgresql_password[0].result),
repmgr_username = "repmgr",
repmgr_password = var.custom_credentials_enabled ? var.custom_credentials_config.repmgr_password : nonsensitive(random_password.repmgrPassword[0].result),
}
}

Expand Down
12 changes: 6 additions & 6 deletions modules/resources/gcp/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
output "postgresql_credential" {
description = "PostgreSQL credentials used for accessing the database."
value = var.postgresql_config.store_password_to_secret_manager ? null : {
postgresql_username = "postgres",
postgres_password = var.custom_credentials_enabled ? var.custom_credentials_config.postgres_password : nonsensitive(random_password.postgresql_password[0].result),
repmgr_username = "repmgr",
repmgr_password = var.custom_credentials_enabled ? var.custom_credentials_config.repmgr_password : nonsensitive(random_password.repmgrPassword[0].result),
value = {
posgresql_username = "postgres",
postgres_password = var.custom_credentials_enabled ? var.custom_credentials_config.postgres_password : nonsensitive(random_password.postgresql_password[0].result),
repmgr_username = "repmgr",
repmgr_password = var.custom_credentials_enabled ? var.custom_credentials_config.repmgr_password : nonsensitive(random_password.repmgrPassword[0].result),
}
}

Expand All @@ -16,4 +16,4 @@ output "postgres_password" {
output "repmgr_password" {
description = "Replication manager password"
value = var.custom_credentials_enabled ? var.custom_credentials_config.repmgr_password : nonsensitive(random_password.repmgrPassword[0].result)
}
}
4 changes: 2 additions & 2 deletions variable.tf
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ variable "custom_credentials_config" {
variable "postgres_password" {
description = "PostgresQL password"
default = ""
type = string
type = any
}

variable "repmgr_password" {
description = "Replication manager password"
default = ""
type = string
type = any
}