Skip to content

Commit

Permalink
CPR-541-person-match-rds-prod
Browse files Browse the repository at this point in the history
  • Loading branch information
JunaedAhmedMOJ committed Jan 15, 2025
1 parent 5ca39f3 commit 7442406
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module "hmpps_person_match_irsa" {
source = "github.com/ministryofjustice/cloud-platform-terraform-irsa?ref=2.0.0" # use the latest release

# EKS configuration
eks_cluster_name = var.eks_cluster_name

# IRSA configuration
service_account_name = "hmpps-person-match-${var.environment}"
role_policy_arns = {
rds = module.hmpps_person_match_rds.irsa_policy_arn
}

# Tags
business_unit = var.business_unit
application = var.application
is_production = var.is_production
team_name = var.team_name
namespace = var.namespace # this is also used to attach your service account to your namespace
environment_name = var.environment
infrastructure_support = var.infrastructure_support
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
module "hmpps_person_match_rds" {
source = "github.com/ministryofjustice/cloud-platform-terraform-rds-instance?ref=8.0.1"
vpc_name = var.vpc_name
team_name = var.team_name
business_unit = var.business_unit
application = var.application
is_production = var.is_production
namespace = var.namespace
environment_name = var.environment
infrastructure_support = var.infrastructure_support
db_max_allocated_storage = "500"
rds_family = "postgres16"
db_instance_class = "db.t4g.micro"
db_engine = "postgres"
db_engine_version = "16"
prepare_for_major_upgrade = false
allow_major_version_upgrade = "true"
enable_rds_auto_start_stop = true

providers = {
aws = aws.london
}
}

resource "kubernetes_secret" "hmpps_person_match_rds" {
metadata {
name = "hmpps-person-match-rds-instance-output"
namespace = var.namespace
}

data = {
rds_instance_endpoint = module.hmpps_person_match_rds.rds_instance_endpoint
database_name = module.hmpps_person_match_rds.database_name
database_username = module.hmpps_person_match_rds.database_username
database_password = module.hmpps_person_match_rds.database_password
rds_instance_address = module.hmpps_person_match_rds.rds_instance_address
url = "postgres://${module.hmpps_person_match_rds.database_username}:${module.hmpps_person_match_rds.database_password}@${module.hmpps_person_match_rds.rds_instance_endpoint}/${module.hmpps_person_match_rds.database_name}"
}
}

0 comments on commit 7442406

Please sign in to comment.