Skip to content

Commit

Permalink
Merge pull request #4637 from ministryofjustice/chaps-rds-restore
Browse files Browse the repository at this point in the history
restore rds from snapshot
  • Loading branch information
roncitrus authored Jan 22, 2024
2 parents 1fc63f2 + 0434ba1 commit 71e6401
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
3 changes: 3 additions & 0 deletions terraform/environments/cdpt-chaps/application_variables.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"db_name": "chaps-dev",
"env_name": "DEVELOPMENT",
"db_instance_identifier": "db-chaps-dev",
"db_snapshot_identifier": "arn:aws:rds:eu-west-2:613903586696:snapshot:cdpt-dev-staging-snapshot-9-1-24",
"docker_image_tag": "development",
"app_count": 1,
"ec2_desired_capacity": 1,
Expand All @@ -25,6 +26,7 @@
"db_name": "chaps-staging",
"env_name": "STAGING",
"db_instance_identifier": "chaps-preprod-instance",
"db_snapshot_identifier": "arn:aws:rds:eu-west-2:613903586696:snapshot:cdpt-dev-staging-snapshot-9-1-24",
"docker_image_tag": "preproduction",
"app_count": 2,
"ec2_desired_capacity": 2,
Expand All @@ -43,6 +45,7 @@
"db_name": "chaps-prod",
"env_name": "PRODUCTION",
"db_instance_identifier": "chaps-prod-instance",
"db_snapshot_identifier": "arn:aws:rds:eu-west-2:613903586696:snapshot:chaps-prod-snapshot-2024-01-19",
"docker_image_tag": "production",
"app_count": 2,
"ec2_desired_capacity": 2,
Expand Down
22 changes: 9 additions & 13 deletions terraform/environments/cdpt-chaps/database.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
#------------------------------------------------------------------------------

resource "aws_db_instance" "database" {
allocated_storage = local.application_data.accounts[local.environment].db_allocated_storage
storage_type = "gp2"
engine = "sqlserver-web"
engine_version = "14.00.3381.3.v1"
instance_class = local.application_data.accounts[local.environment].db_instance_class
identifier = local.application_data.accounts[local.environment].db_instance_identifier
# username = local.application_data.accounts[local.environment].db_user
allocated_storage = local.application_data.accounts[local.environment].db_allocated_storage
storage_type = "gp2"
engine = "sqlserver-web"
engine_version = "14.00.3381.3.v1"
instance_class = local.application_data.accounts[local.environment].db_instance_class
identifier = local.application_data.accounts[local.environment].db_instance_identifier
username = local.application_data.accounts[local.environment].db_user
password = aws_secretsmanager_secret_version.db_password.secret_string
vpc_security_group_ids = [aws_security_group.db.id]
depends_on = [aws_security_group.db]
# snapshot_identifier = "arn:aws:rds:eu-west-2:613903586696:snapshot:chaps-prod-snapshot-2024-01-19"
db_subnet_group_name = aws_db_subnet_group.db.id
snapshot_identifier = local.application_data.accounts[local.environment].db_snapshot_identifier
db_subnet_group_name = aws_db_subnet_group.db.id
final_snapshot_identifier = "final-snapshot"
publicly_accessible = true
}
Expand All @@ -25,10 +25,6 @@ resource "aws_db_instance_role_association" "database" {
role_arn = aws_iam_role.S3_db_backup_restore_access.arn
}

output "s3_db_backup_restore_access_role_arn" {
value = aws_iam_role.S3_db_backup_restore_access.arn
}

resource "aws_db_subnet_group" "db" {
name = "${local.application_name}-db-subnet-group"
subnet_ids = sort(data.aws_subnets.shared-data.ids)
Expand Down

0 comments on commit 71e6401

Please sign in to comment.