Skip to content

Commit

Permalink
attempts to get connection string passed
Browse files Browse the repository at this point in the history
  • Loading branch information
m-goggins committed Sep 18, 2024
1 parent 39f589d commit 9f7b909
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 0 deletions.
26 changes: 26 additions & 0 deletions terraform/aws/implementation/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,29 @@ module "rds" {
private_subnet_ids = module.vpc.private_subnets
eks_assume_role_policy = module.eks.eks_assume_role_policy
}

module "helm" {
source = "terraform-helm-release"

set {
name = "db.connectionString"
value = module.rds.tefca_db_connection_string
}

# Anything else need to go here???
}

# not sure what the difference is between this and the above module
resource "helm_release" "flyway" {
name = "flyway"
repository = "https://charts.example.com" # Replace with your chart repository URL
chart = "flyway"
version = "1.0.0" # Replace with the chart version you are using

set {
name = "db.connectionString"
value = module.rds.tefca_db_connection_string
}

# Other settings for the Helm release
}
1 change: 1 addition & 0 deletions terraform/aws/implementation/modules/rds/main.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Define the RDS instance for Postgres
resource "aws_db_instance" "tefca-viewer-db" {
identifier = var.db_identifier
db_name = var.tefca_db_name
instance_class = "db.t3.micro"
allocated_storage = 5
engine = var.engine_type
Expand Down
5 changes: 5 additions & 0 deletions terraform/aws/implementation/modules/rds/output.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
output "tefca_viewer_db_role_arn" {
value = aws_iam_role.db_role_for_tefca_viewer.arn
}

output "tefca_db_connection_string" {
value = "postgresql://${aws_db_instance.tefca-viewer-db.username}:${aws_db_instance.tefca-viewer-db.password}@${aws_db_instance.tefca-viewer-db.endpoint}:5432/${aws_db_instance.tefca-viewer-db.db_name}"
sensitive = true
}
6 changes: 6 additions & 0 deletions terraform/aws/implementation/modules/rds/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,9 @@ variable "vpc_id" {
type = string
description = "ID of the VPC"
}

variable "tefca_db_name" {
type = string
description = "The name of the tefca database"
default = "tefca_db"
}

0 comments on commit 9f7b909

Please sign in to comment.