Skip to content

Commit 4bd0d7b

Browse files
Merge pull request #6 from RohitSquareops/release-bug-fix
updated ref architecture , fix password issue
2 parents e327419 + 3bb8f46 commit 4bd0d7b

File tree

8 files changed

+26
-34
lines changed

8 files changed

+26
-34
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,13 @@ No modules.
111111
| <a name="input_cluster_name"></a> [cluster\_name](#input\_cluster\_name) | Name of eks cluster | `string` | `""` | no |
112112
| <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 |
113113
| <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 |
114-
| <a name="input_postgres_password"></a> [postgres\_password](#input\_postgres\_password) | PostgresQL password | `string` | `""` | no |
114+
| <a name="input_postgres_password"></a> [postgres\_password](#input\_postgres\_password) | PostgresQL password | `any` | `""` | no |
115115
| <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 |
116116
| <a name="input_postgresql_enabled"></a> [postgresql\_enabled](#input\_postgresql\_enabled) | Whether or not to deploy postgresql | `bool` | `true` | no |
117117
| <a name="input_postgresql_exporter_enabled"></a> [postgresql\_exporter\_enabled](#input\_postgresql\_exporter\_enabled) | Whether or not to deploy postgresql exporter | `bool` | `false` | no |
118118
| <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 |
119119
| <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 |
120-
| <a name="input_repmgr_password"></a> [repmgr\_password](#input\_repmgr\_password) | Replication manager password | `string` | `""` | no |
120+
| <a name="input_repmgr_password"></a> [repmgr\_password](#input\_repmgr\_password) | Replication manager password | `any` | `""` | no |
121121

122122
## Outputs
123123

examples/complete/aws/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ No requirements.
2121

2222
| Name | Source | Version |
2323
|------|--------|---------|
24-
| <a name="module_aws"></a> [aws](#module\_aws) | [email protected]:sq-ia/terraform-kubernetes-postgresql.git//modules/resources/aws | n/a |
25-
| <a name="module_postgresql"></a> [postgresql](#module\_postgresql) | [email protected]:sq-ia/terraform-kubernetes-postgresql.git | n/a |
24+
| <a name="module_aws"></a> [aws](#module\_aws) | ../../../modules/resources/aws | n/a |
25+
| <a name="module_postgresql"></a> [postgresql](#module\_postgresql) | ../../../ | n/a |
2626

2727
## Resources
2828

examples/complete/aws/main.tf

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
locals {
22
name = "postgresql"
33
region = "us-east-2"
4-
environment = "prod"
4+
environment = "prodd"
55
additional_tags = {
66
Owner = "organization_name"
77
Expires = "Never"
88
Department = "Engineering"
99
}
1010
store_password_to_secret_manager = true
11-
custom_credentials_enabled = false
11+
custom_credentials_enabled = true
1212
custom_credentials_config = {
1313
postgres_password = "60rbJs901a6Oa9hzUM5x7s8Q"
1414
repmgr_password = "IWHLlEYOt25jL4Io7pancB"
@@ -19,7 +19,7 @@ module "aws" {
1919
source = "[email protected]:sq-ia/terraform-kubernetes-postgresql.git//modules/resources/aws"
2020
name = local.name
2121
environment = local.environment
22-
cluster_name = "cluster-name"
22+
cluster_name = ""
2323
store_password_to_secret_manager = local.store_password_to_secret_manager
2424
custom_credentials_enabled = local.custom_credentials_enabled
2525
custom_credentials_config = local.custom_credentials_config
@@ -28,6 +28,10 @@ module "aws" {
2828
module "postgresql" {
2929
source = "[email protected]:sq-ia/terraform-kubernetes-postgresql.git"
3030
postgresql_exporter_enabled = true
31+
custom_credentials_enabled = local.custom_credentials_enabled
32+
custom_credentials_config = local.custom_credentials_config
33+
repmgr_password = module.aws.postgresql_credential.repmgr_password
34+
postgres_password = module.aws.postgresql_credential.postgres_password
3135
postgresql_config = {
3236
name = local.name
3337
environment = local.environment

modules/resources/aws/outputs.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
output "postgresql_credential" {
22
description = "PostgreSQL credentials used for accessing the database."
3-
value = var.postgresql_config.store_password_to_secret_manager ? null : {
3+
value = {
44
posgresql_username = "postgres",
55
postgres_password = var.custom_credentials_enabled ? var.custom_credentials_config.postgres_password : nonsensitive(random_password.postgresql_password[0].result),
66
repmgr_username = "repmgr",
77
repmgr_password = var.custom_credentials_enabled ? var.custom_credentials_config.repmgr_password : nonsensitive(random_password.repmgrPassword[0].result),
88
}
9-
}
9+
}

modules/resources/aws/variables.tf

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,3 @@ variable "store_password_to_secret_manager" {
3939
type = bool
4040
default = false
4141
}
42-
43-
variable "postgresql_config" {
44-
description = "Custom credentials configuration."
45-
default = {
46-
name = ""
47-
environment = ""
48-
replicaCount = 3
49-
storage_class = "gp2"
50-
postgresql_values = ""
51-
store_password_to_secret_manager = true
52-
}
53-
}

modules/resources/azure/outputs.tf

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
output "postgresql_credential" {
22
description = "PostgreSQL credentials used for accessing the database."
3-
value = var.postgresql_config.store_password_to_secret_manager ? null : {
4-
postgresql_username = "postgres",
5-
postgres_password = var.custom_credentials_enabled ? var.custom_credentials_config.postgres_password : nonsensitive(random_password.postgresql_password[0].result),
6-
repmgr_username = "repmgr",
7-
repmgr_password = var.custom_credentials_enabled ? var.custom_credentials_config.repmgr_password : nonsensitive(random_password.repmgrPassword[0].result),
3+
value = {
4+
posgresql_username = "postgres",
5+
postgres_password = var.custom_credentials_enabled ? var.custom_credentials_config.postgres_password : nonsensitive(random_password.postgresql_password[0].result),
6+
repmgr_username = "repmgr",
7+
repmgr_password = var.custom_credentials_enabled ? var.custom_credentials_config.repmgr_password : nonsensitive(random_password.repmgrPassword[0].result),
88
}
99
}
1010

modules/resources/gcp/outputs.tf

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
output "postgresql_credential" {
22
description = "PostgreSQL credentials used for accessing the database."
3-
value = var.postgresql_config.store_password_to_secret_manager ? null : {
4-
postgresql_username = "postgres",
5-
postgres_password = var.custom_credentials_enabled ? var.custom_credentials_config.postgres_password : nonsensitive(random_password.postgresql_password[0].result),
6-
repmgr_username = "repmgr",
7-
repmgr_password = var.custom_credentials_enabled ? var.custom_credentials_config.repmgr_password : nonsensitive(random_password.repmgrPassword[0].result),
3+
value = {
4+
posgresql_username = "postgres",
5+
postgres_password = var.custom_credentials_enabled ? var.custom_credentials_config.postgres_password : nonsensitive(random_password.postgresql_password[0].result),
6+
repmgr_username = "repmgr",
7+
repmgr_password = var.custom_credentials_enabled ? var.custom_credentials_config.repmgr_password : nonsensitive(random_password.repmgrPassword[0].result),
88
}
99
}
1010

@@ -16,4 +16,4 @@ output "postgres_password" {
1616
output "repmgr_password" {
1717
description = "Replication manager password"
1818
value = var.custom_credentials_enabled ? var.custom_credentials_config.repmgr_password : nonsensitive(random_password.repmgrPassword[0].result)
19-
}
19+
}

variable.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@ variable "custom_credentials_config" {
6565
variable "postgres_password" {
6666
description = "PostgresQL password"
6767
default = ""
68-
type = string
68+
type = any
6969
}
7070

7171
variable "repmgr_password" {
7272
description = "Replication manager password"
7373
default = ""
74-
type = string
74+
type = any
7575
}

0 commit comments

Comments
 (0)