Skip to content

Commit b151fbd

Browse files
authored
refactor: remove database_type variable and update connection string conditionals (#31)
- Remove the unused database_type variable definition. - Update local.tf to use secrets_manager versions for connection strings instead of database_type checks. - Adjust README.md to remove documentation for the database_type input.
1 parent 0ecf46f commit b151fbd

3 files changed

Lines changed: 7 additions & 14 deletions

File tree

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,6 @@ No modules.
191191
| <a name="input_certificate_arn"></a> [certificate\_arn](#input\_certificate\_arn) | ARN of the SSL certificate that enables ssl termination on the ALB | `string` | `""` | no |
192192
| <a name="input_cloudmap_namespace_name"></a> [cloudmap\_namespace\_name](#input\_cloudmap\_namespace\_name) | Name of the AWS Cloud Map namespace | `string` | `""` | no |
193193
| <a name="input_cw_retention_in_days"></a> [cw\_retention\_in\_days](#input\_cw\_retention\_in\_days) | Retention period in days for CloudWatch logs | `number` | `30` | no |
194-
| <a name="input_database_type"></a> [database\_type](#input\_database\_type) | The type of database to use (postgresql or sqlserver) | `string` | `"postgresql"` | no |
195194
| <a name="input_db_cipher"></a> [db\_cipher](#input\_db\_cipher) | The cipher to use for the sql server database connection | `string` | `""` | no |
196195
| <a name="input_dibbs_config_name"></a> [dibbs\_config\_name](#input\_dibbs\_config\_name) | Name of the DIBBS configuration | `string` | `""` | no |
197196
| <a name="input_dibbs_repo"></a> [dibbs\_repo](#input\_dibbs\_repo) | Name of the DIBBS repository | `string` | `"ghcr.io/cdcgov/dibbs-ecr-viewer"` | no |
@@ -207,7 +206,7 @@ No modules.
207206
| <a name="input_enable_alb_logs"></a> [enable\_alb\_logs](#input\_enable\_alb\_logs) | Flag to enable ALB access and connection logging to s3 logging bucket | `bool` | `true` | no |
208207
| <a name="input_enable_autoscaling"></a> [enable\_autoscaling](#input\_enable\_autoscaling) | Flag to enable autoscaling for the ECS services | `bool` | `true` | no |
209208
| <a name="input_internal"></a> [internal](#input\_internal) | Flag to determine if the several AWS resources are public (intended for external access, public internet) or private (only intended to be accessed within your AWS VPC or avaiable with other means, a transit gateway for example). | `bool` | `true` | no |
210-
| <a name="input_override_autoscaling"></a> [override\_autoscaling](#input\_override\_autoscaling) | Autoscaling configuration for the DIBBS services | <pre>map(object({<br/> cpu = number<br/> memory = number<br/> min_capacity = number<br/> max_capacity = number<br/> target_cpu = number<br/> target_memory = number<br/> }))</pre> | `{}` | no |
209+
| <a name="input_override_autoscaling"></a> [override\_autoscaling](#input\_override\_autoscaling) | Autoscaling configuration for the DIBBS services | <pre>map(object({<br> cpu = number<br> memory = number<br> min_capacity = number<br> max_capacity = number<br> target_cpu = number<br> target_memory = number<br> }))</pre> | `{}` | no |
211210
| <a name="input_owner"></a> [owner](#input\_owner) | Owner of the resources | `string` | `"CDC"` | no |
212211
| <a name="input_phdi_version"></a> [phdi\_version](#input\_phdi\_version) | Version of the PHDI application | `string` | `"v2.0.0-beta"` | no |
213212
| <a name="input_private_subnet_ids"></a> [private\_subnet\_ids](#input\_private\_subnet\_ids) | List of private subnet IDs | `list(string)` | n/a | yes |
@@ -223,7 +222,7 @@ No modules.
223222
| <a name="input_secrets_manager_sqlserver_host_version"></a> [secrets\_manager\_sqlserver\_host\_version](#input\_secrets\_manager\_sqlserver\_host\_version) | n/a | `string` | `""` | no |
224223
| <a name="input_secrets_manager_sqlserver_password_version"></a> [secrets\_manager\_sqlserver\_password\_version](#input\_secrets\_manager\_sqlserver\_password\_version) | n/a | `string` | `""` | no |
225224
| <a name="input_secrets_manager_sqlserver_user_version"></a> [secrets\_manager\_sqlserver\_user\_version](#input\_secrets\_manager\_sqlserver\_user\_version) | n/a | `string` | `""` | no |
226-
| <a name="input_service_data"></a> [service\_data](#input\_service\_data) | Data for the DIBBS services | <pre>map(object({<br/> short_name = string<br/> app_repo = string<br/> app_image = string<br/> app_version = string<br/> container_port = number<br/> host_port = number<br/> public = bool<br/> registry_url = string<br/> root_service = bool<br/> listener_priority = number<br/> env_vars = list(object({<br/> name = string<br/> value = string<br/> }))<br/> }))</pre> | `{}` | no |
225+
| <a name="input_service_data"></a> [service\_data](#input\_service\_data) | Data for the DIBBS services | <pre>map(object({<br> short_name = string<br> app_repo = string<br> app_image = string<br> app_version = string<br> container_port = number<br> host_port = number<br> public = bool<br> registry_url = string<br> root_service = bool<br> listener_priority = number<br> env_vars = list(object({<br> name = string<br> value = string<br> }))<br> }))</pre> | `{}` | no |
227226
| <a name="input_tags"></a> [tags](#input\_tags) | Tags to apply to resources | `map(string)` | `{}` | no |
228227
| <a name="input_vpc_id"></a> [vpc\_id](#input\_vpc\_id) | ID of the VPC | `string` | n/a | yes |
229228

_local.tf

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,23 @@ locals {
99
registry_username = data.aws_ecr_authorization_token.this.user_name
1010
registry_password = data.aws_ecr_authorization_token.this.password
1111
dibbs_repo = var.dibbs_repo
12-
database_url = var.database_type == "postgresql" ? {
12+
database_url = var.secrets_manager_postgresql_connection_string_version != "" ? {
1313
name = "DATABASE_URL",
1414
value = var.secrets_manager_postgresql_connection_string_version
1515
} : null
16-
sqlserver_user = var.database_type == "sqlserver" ? {
16+
sqlserver_user = var.secrets_manager_sqlserver_user_version != "" ? {
1717
name = "SQL_SERVER_USER",
1818
value = var.secrets_manager_sqlserver_user_version
1919
} : null
20-
sqlserver_password = var.database_type == "sqlserver" ? {
20+
sqlserver_password = var.secrets_manager_sqlserver_password_version != "" ? {
2121
name = "SQL_SERVER_PASSWORD",
2222
value = var.secrets_manager_sqlserver_password_version
2323
} : null
24-
sqlserver_host = var.database_type == "sqlserver" ? {
24+
sqlserver_host = var.secrets_manager_sqlserver_host_version != "" ? {
2525
name = "SQL_SERVER_HOST",
2626
value = var.secrets_manager_sqlserver_host_version
2727
} : null
28-
db_cipher = var.database_type == "sqlserver" ? {
28+
db_cipher = var.db_cipher != "" ? {
2929
name = "DB_CIPHER",
3030
value = var.db_cipher
3131
} : null

_variable.tf

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,12 +142,6 @@ variable "override_autoscaling" {
142142
default = {}
143143
}
144144

145-
variable "database_type" {
146-
type = string
147-
description = "The type of database to use (postgresql or sqlserver)"
148-
default = "postgresql"
149-
}
150-
151145
variable "secrets_manager_postgresql_connection_string_version" {
152146
type = string
153147
default = ""

0 commit comments

Comments
 (0)