diff --git a/terraform/environments/cdpt-chaps/application_variables.json b/terraform/environments/cdpt-chaps/application_variables.json index 7ba86bac2b5..040992cf89d 100644 --- a/terraform/environments/cdpt-chaps/application_variables.json +++ b/terraform/environments/cdpt-chaps/application_variables.json @@ -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, @@ -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, @@ -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, diff --git a/terraform/environments/cdpt-chaps/database.tf b/terraform/environments/cdpt-chaps/database.tf index 7edf5cca8bc..1872f3139b4 100644 --- a/terraform/environments/cdpt-chaps/database.tf +++ b/terraform/environments/cdpt-chaps/database.tf @@ -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 } @@ -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)