Skip to content

Commit

Permalink
util updates
Browse files Browse the repository at this point in the history
  • Loading branch information
alismx committed Jan 29, 2025
1 parent 757432a commit c60d72d
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 48 deletions.
2 changes: 1 addition & 1 deletion terraform/implementation/ecs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_availability_zones"></a> [availability\_zones](#input\_availability\_zones) | The availability zones to use | `list(string)` | <pre>[<br> "us-east-1a",<br> "us-east-1b",<br> "us-east-1c"<br>]</pre> | no |
| <a name="input_database_type"></a> [database\_type](#input\_database\_type) | The type of database to use (postgresql or sqlserver) | `string` | `"sqlserver"` | no |
| <a name="input_database_type"></a> [database\_type](#input\_database\_type) | The type of database to use (postgresql or sqlserver) | `string` | `""` | no |
| <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` | `false` | no |
| <a name="input_owner"></a> [owner](#input\_owner) | The owner of the infrastructure | `string` | `"skylight"` | no |
| <a name="input_phdi_version"></a> [phdi\_version](#input\_phdi\_version) | PHDI container image version | `string` | `"44bc4b087f1f371f63ee270aba98589c542d72ba"` | no |
Expand Down
24 changes: 0 additions & 24 deletions terraform/implementation/ecs/_variable.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,30 +29,6 @@ variable "database_type" {
default = ""
}

# variable "postgresql_connection_string_name" {
# description = "The name of the secret in AWS Secrets Manager for the Postgresql connection string"
# type = string
# default = ""
# }

# variable "secrets_manager_sqlserver_host_name" {
# description = "The name of the secret in AWS Secrets Manager for the SqlServer host name"
# type = string
# default = ""
# }

# variable "secrets_manager_sqlserver_password_name" {
# description = "The name of the secret in AWS Secrets Manager for the SqlServer password"
# type = string
# default = ""
# }

# variable "secrets_manager_sqlserver_user_name" {
# description = "The name of the secret in AWS Secrets Manager for the SqlServer user name"
# type = string
# default = ""
# }

variable "private_subnets" {
description = "The private subnets"
type = list(string)
Expand Down
3 changes: 2 additions & 1 deletion terraform/implementation/setup/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@

| Name | Source | Version |
|------|--------|---------|
| <a name="module_oidc"></a> [oidc](#module\_oidc) | ../../modules/oidc | n/a |
| <a name="module_oidc_dev"></a> [oidc\_dev](#module\_oidc\_dev) | ../../modules/oidc | n/a |
| <a name="module_oidc_prod"></a> [oidc\_prod](#module\_oidc\_prod) | ../../modules/oidc | n/a |
| <a name="module_tfstate"></a> [tfstate](#module\_tfstate) | ../../modules/tfstate | n/a |

## Resources
Expand Down
2 changes: 2 additions & 0 deletions terraform/modules/db/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ No modules.
| [aws_security_group.postgresql](https://registry.terraform.io/providers/hashicorp/aws/5.56.1/docs/resources/security_group) | resource |
| [aws_security_group.sqlserver](https://registry.terraform.io/providers/hashicorp/aws/5.56.1/docs/resources/security_group) | resource |
| [random_password.database](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/password) | resource |
| [aws_rds_engine_version.postgresql](https://registry.terraform.io/providers/hashicorp/aws/5.56.1/docs/data-sources/rds_engine_version) | data source |
| [aws_rds_engine_version.sqlserver](https://registry.terraform.io/providers/hashicorp/aws/5.56.1/docs/data-sources/rds_engine_version) | data source |

## Inputs

Expand Down
10 changes: 5 additions & 5 deletions terraform/modules/db/_local.tf
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
locals {
vpc_name = "${var.project}-${var.owner}-${terraform.workspace}"
sqlserver_engine = "sqlserver-ex"
sqlserver_engine_version = "16.00.4165.4.v1"
sqlserver_instance_class = "db.t3.micro"
postgresql_engine = "postgres"
vpc_name = "${var.project}-${var.owner}-${terraform.workspace}"
sqlserver_engine = "sqlserver-ex"
sqlserver_engine_version = "16.00.4165.4.v1"
sqlserver_instance_class = "db.t3.micro"
postgresql_engine = "postgres"
postgresql_engine_version = "16.4"
postgresql_instance_class = "db.t3.micro"
}
4 changes: 2 additions & 2 deletions terraform/modules/db/postgresql.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
data "aws_rds_engine_version" "postgresql" {
engine = local.postgresql_engine
preferred_versions = [ local.postgresql_engine_version ]
engine = local.postgresql_engine
preferred_versions = [local.postgresql_engine_version]
}

resource "aws_db_instance" "postgresql" {
Expand Down
30 changes: 15 additions & 15 deletions terraform/modules/db/sqlserver.tf
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
data "aws_rds_engine_version" "sqlserver" {
engine = local.sqlserver_engine
preferred_versions = [ local.sqlserver_engine_version ]
engine = local.sqlserver_engine
preferred_versions = [local.sqlserver_engine_version]
}

resource "aws_db_instance" "sqlserver" {
count = var.database_type == "sqlserver" ? 1 : 0
allocated_storage = "20"
identifier = "${local.vpc_name}-${var.database_type}-ecr-viewer"
engine = data.aws_rds_engine_version.sqlserver.engine
engine_version = data.aws_rds_engine_version.sqlserver.version_actual
count = var.database_type == "sqlserver" ? 1 : 0
allocated_storage = "20"
identifier = "${local.vpc_name}-${var.database_type}-ecr-viewer"
engine = data.aws_rds_engine_version.sqlserver.engine
engine_version = data.aws_rds_engine_version.sqlserver.version_actual
enabled_cloudwatch_logs_exports = []
instance_class = local.sqlserver_instance_class
username = "sa"
password = random_password.database.result
parameter_group_name = aws_db_parameter_group.sqlserver[0].name
skip_final_snapshot = true
db_subnet_group_name = aws_db_subnet_group.this.name
vpc_security_group_ids = [aws_security_group.sqlserver.id]
license_model = "license-included"
instance_class = local.sqlserver_instance_class
username = "sa"
password = random_password.database.result
parameter_group_name = aws_db_parameter_group.sqlserver[0].name
skip_final_snapshot = true
db_subnet_group_name = aws_db_subnet_group.this.name
vpc_security_group_ids = [aws_security_group.sqlserver.id]
license_model = "license-included"
}

# Create a parameter group to configure SqlServer RDS parameters
Expand Down

0 comments on commit c60d72d

Please sign in to comment.