Skip to content

Commit d656d71

Browse files
authored
Merge pull request #19 from infraspecdev/rahul-infra/added-inputvar-for-postgres-version
Added input variable for postgres version
2 parents 742a251 + d61c518 commit d656d71

File tree

6 files changed

+46
-9
lines changed

6 files changed

+46
-9
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ aws ssm put-parameter --name "/rds/POSTGRES_DB_NAME" --value "value" --type "Sec
8686
| <a name="input_multi_az"></a> [multi\_az](#input\_multi\_az) | Specifies if the RDS instance is multi-AZ | `bool` | `false` | no |
8787
| <a name="input_performance_insights_enabled"></a> [performance\_insights\_enabled](#input\_performance\_insights\_enabled) | Whether to enable performance insights | `bool` | `true` | no |
8888
| <a name="input_performance_insights_retention_period"></a> [performance\_insights\_retention\_period](#input\_performance\_insights\_retention\_period) | The retention period for performance insights | `number` | `7` | no |
89+
| <a name="input_postgres_engine_version"></a> [postgres\_engine\_version](#input\_postgres\_engine\_version) | PostgreSQL engine version for the RDS instance (e.g., 15.4, 16.3). Defaults to latest supported. | `number` | `16.3` | no |
90+
| <a name="input_postgres_major_engine_version"></a> [postgres\_major\_engine\_version](#input\_postgres\_major\_engine\_version) | Major PostgreSQL engine version (e.g., 15, 16). Used for parameter group family naming. | `number` | `16` | no |
8991
| <a name="input_private_subnet_ids"></a> [private\_subnet\_ids](#input\_private\_subnet\_ids) | List of private subnet IDs for database and Kong ECS deployment | `list(string)` | n/a | yes |
9092
| <a name="input_public_subnet_ids"></a> [public\_subnet\_ids](#input\_public\_subnet\_ids) | List of public subnet IDs for public-facing load balancers | `list(string)` | n/a | yes |
9193
| <a name="input_rds_db_tags"></a> [rds\_db\_tags](#input\_rds\_db\_tags) | List of tags | `map(string)` | `{}` | no |

examples/complete/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ No resources.
8888
| <a name="input_multi_az"></a> [multi\_az](#input\_multi\_az) | Specifies if the RDS instance is multi-AZ | `bool` | n/a | yes |
8989
| <a name="input_performance_insights_enabled"></a> [performance\_insights\_enabled](#input\_performance\_insights\_enabled) | Whether to enable performance insights | `bool` | n/a | yes |
9090
| <a name="input_performance_insights_retention_period"></a> [performance\_insights\_retention\_period](#input\_performance\_insights\_retention\_period) | The retention period for performance insights | `number` | n/a | yes |
91+
| <a name="input_postgres_engine_version"></a> [postgres\_engine\_version](#input\_postgres\_engine\_version) | The version of the Postgres engine | `number` | n/a | yes |
92+
| <a name="input_postgres_major_engine_version"></a> [postgres\_major\_engine\_version](#input\_postgres\_major\_engine\_version) | The major version of the Postgres engine | `number` | n/a | yes |
9193
| <a name="input_private_subnet_ids"></a> [private\_subnet\_ids](#input\_private\_subnet\_ids) | List of private subnet IDs | `list(string)` | n/a | yes |
9294
| <a name="input_public_subnet_ids"></a> [public\_subnet\_ids](#input\_public\_subnet\_ids) | List of public subnet IDs | `list(string)` | n/a | yes |
9395
| <a name="input_rds_db_tags"></a> [rds\_db\_tags](#input\_rds\_db\_tags) | List of tags | `map(string)` | n/a | yes |

examples/complete/main.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,6 @@ module "kong" {
2828
memory_for_kong_task = var.memory_for_kong_task
2929
desired_count_for_kong_service = var.desired_count_for_kong_service
3030
force_new_deployment = var.force_new_deployment
31+
postgres_engine_version = var.postgres_engine_version
32+
postgres_major_engine_version = var.postgres_major_engine_version
3133
}

examples/complete/variables.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,3 +122,13 @@ variable "force_new_deployment" {
122122
description = "Whether to force new deployment"
123123
type = bool
124124
}
125+
126+
variable "postgres_engine_version" {
127+
description = "The version of the Postgres engine"
128+
type = number
129+
}
130+
131+
variable "postgres_major_engine_version" {
132+
description = "The major version of the Postgres engine"
133+
type = number
134+
}

locals.tf

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,16 @@ locals {
1414
engine = "postgres"
1515
storage_encrypted = true
1616
storage_type = "gp3"
17-
engine_version = 16.3
18-
engine_family = "postgres16"
19-
major_engine_version = 16
20-
port = 5432
21-
sg_name = "kong-postgres"
22-
sg_description = "Allow all traffic within vpc"
23-
postgres_username = data.aws_ssm_parameter.rds["POSTGRES_USERNAME"].value
24-
postgres_password = data.aws_ssm_parameter.rds["POSTGRES_PASSWORD"].value
25-
postgres_db_name = data.aws_ssm_parameter.rds["POSTGRES_DB_NAME"].value
17+
engine_version = var.postgres_engine_version
18+
engine_family = "postgres${var.postgres_major_engine_version}"
19+
major_engine_version = var.postgres_major_engine_version
20+
21+
port = 5432
22+
sg_name = "kong-postgres"
23+
sg_description = "Allow all traffic within vpc"
24+
postgres_username = data.aws_ssm_parameter.rds["POSTGRES_USERNAME"].value
25+
postgres_password = data.aws_ssm_parameter.rds["POSTGRES_PASSWORD"].value
26+
postgres_db_name = data.aws_ssm_parameter.rds["POSTGRES_DB_NAME"].value
2627
}
2728

2829
ecs = {

variables.tf

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,3 +161,23 @@ variable "force_new_deployment" {
161161
type = bool
162162
default = true
163163
}
164+
165+
variable "postgres_engine_version" {
166+
description = "PostgreSQL engine version for the RDS instance (e.g., 15.4, 16.3). Defaults to latest supported."
167+
type = number
168+
default = 16.3
169+
validation {
170+
condition = var.postgres_engine_version >= 16
171+
error_message = "The PostgreSQL engine version must be 16 or higher."
172+
}
173+
}
174+
175+
variable "postgres_major_engine_version" {
176+
description = "Major PostgreSQL engine version (e.g., 15, 16). Used for parameter group family naming."
177+
type = number
178+
default = 16
179+
validation {
180+
condition = var.postgres_major_engine_version >= 16
181+
error_message = "The major PostgreSQL engine version must be 16 or higher."
182+
}
183+
}

0 commit comments

Comments
 (0)