Skip to content

Commit

Permalink
Merge pull request #6597 from ministryofjustice/CC-2654/rebuild-ebs-d…
Browse files Browse the repository at this point in the history
…b-development-upgrade

CC-2654: Updated snapshots for ec2-ccms-ebs-development-ebsdb.
  • Loading branch information
mmgovuk authored Jun 24, 2024
2 parents 44c685f + cbd1060 commit 574c6a3
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 5 deletions.
22 changes: 19 additions & 3 deletions terraform/environments/ccms-ebs-upgrade/application_variables.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@
"ebs_size_ebsdb_dbf02": 4000,
"ebs_iops_ebsdb_dbf03": 12000,
"ebs_size_ebsdb_dbf03": 3000,
"ebs_iops_ebsdb_dbf04": 3000,
"ebs_size_ebsdb_dbf04": 500,
"ebs_size_ebsdb_redoA": 100,
"ebs_size_ebsdb_redoB": 50,
"ebs_size_ebsdb_techst": 100,
Expand All @@ -98,9 +100,15 @@
"ebs_default_iops_test": 9000,
"dbf_device": "nvme5n1",
"dbf_path": "/CCMS/EBS/dbf",
"dbf01_snapshot_id": "",
"dbf02_snapshot_id": "",
"dbf03_snapshot_id": "",
"arch_snapshot_id": "snap-06ac9e476306a81f0",
"dbf01_snapshot_id": "snap-052d0aa1b0738b7e8",
"dbf02_snapshot_id": "snap-09f49790bedbce8b9",
"dbf03_snapshot_id": "snap-01d845525a4adb282",
"dbf04_snapshot_id": "snap-037d6f4929f4b7b45",
"redoa_snapshot_id": "snap-0cd7653ebb34fb4d0",
"redob_snapshot_id": "snap-04ef7473cd3b08835",
"techst_snapshot_id": "snap-070ac6c02623d7820",
"home_snapshot_id": "snap-0b3ed6004c1adabc7",
"ebs_type_ebsdb_backup": "gp3",
"ebs_size_ebsconc_exhome": 100,
"ebs_size_ebsconc_u01": 200,
Expand Down Expand Up @@ -204,6 +212,8 @@
"ebs_size_ebsdb_dbf02": 4000,
"ebs_iops_ebsdb_dbf03": 12000,
"ebs_size_ebsdb_dbf03": 3000,
"ebs_iops_ebsdb_dbf04": 3000,
"ebs_size_ebsdb_dbf04": 500,
"ebs_size_ebsdb_redoA": 100,
"ebs_size_ebsdb_redoB": 50,
"ebs_size_ebsdb_techst": 100,
Expand All @@ -213,9 +223,15 @@
"ebs_default_iops_test": 9000,
"dbf_device": "nvme5n1",
"dbf_path": "/CCMS/EBS/dbf",
"arch_snapshot_id": "",
"dbf01_snapshot_id": "snap-04ab84f4b1c4bc04e",
"dbf02_snapshot_id": "snap-01e6b7d595e24bea4",
"dbf03_snapshot_id": "snap-0dcd7f2e82fc77739",
"dbf04_snapshot_id": "",
"redoa_snapshot_id": "",
"redob_snapshot_id": "",
"techst_snapshot_id": "",
"home_snapshot_id": "",
"ebs_type_ebsdb_backup": "gp3",
"ebs_size_ebsconc_exhome": 100,
"ebs_size_ebsconc_u01": 200,
Expand Down
35 changes: 33 additions & 2 deletions terraform/environments/ccms-ebs-upgrade/ec2-oracle_ebs_db.tf
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ resource "aws_ebs_volume" "arch" {
ignore_changes = [kms_key_id]
}
availability_zone = "eu-west-2a"
snapshot_id = length(local.application_data.accounts[local.environment].arch_snapshot_id) > 0 ? local.application_data.accounts[local.environment].arch_snapshot_id : null
size = local.application_data.accounts[local.environment].ebs_size_ebsdb_arch
type = "io2"
iops = 3000
Expand Down Expand Up @@ -238,11 +239,38 @@ resource "aws_volume_attachment" "dbf03_att" {
instance_id = aws_instance.ec2_oracle_ebs.id
}

resource "aws_ebs_volume" "dbf04" {
lifecycle {
ignore_changes = [kms_key_id]
}
availability_zone = "eu-west-2a"
snapshot_id = length(local.application_data.accounts[local.environment].dbf04_snapshot_id) > 0 ? local.application_data.accounts[local.environment].dbf04_snapshot_id : null
size = local.application_data.accounts[local.environment].ebs_size_ebsdb_dbf04
type = "io2"
iops = local.application_data.accounts[local.environment].ebs_iops_ebsdb_dbf04
encrypted = true
kms_key_id = data.aws_kms_key.ebs_shared.key_id
tags = merge(local.tags,
{ Name = lower(format("%s-%s", local.application_data.accounts[local.environment].instance_role_ebsdb, "dbf04")) },
{ device-name = "/dev/sdt" }
)
}

resource "aws_volume_attachment" "dbf04_att" {
depends_on = [
aws_ebs_volume.dbf04
]
device_name = "/dev/sdt"
volume_id = aws_ebs_volume.dbf04.id
instance_id = aws_instance.ec2_oracle_ebs.id
}

resource "aws_ebs_volume" "redoA" {
lifecycle {
ignore_changes = [kms_key_id]
}
availability_zone = "eu-west-2a"
snapshot_id = length(local.application_data.accounts[local.environment].redoa_snapshot_id) > 0 ? local.application_data.accounts[local.environment].redoa_snapshot_id : null
size = local.application_data.accounts[local.environment].ebs_size_ebsdb_redoA
type = "io2"
iops = 3000
Expand All @@ -265,6 +293,7 @@ resource "aws_ebs_volume" "techst" {
ignore_changes = [kms_key_id]
}
availability_zone = "eu-west-2a"
snapshot_id = length(local.application_data.accounts[local.environment].techst_snapshot_id) > 0 ? local.application_data.accounts[local.environment].techst_snapshot_id : null
size = local.application_data.accounts[local.environment].ebs_size_ebsdb_techst
type = "io2"
iops = 3000
Expand Down Expand Up @@ -310,6 +339,7 @@ resource "aws_ebs_volume" "redoB" {
ignore_changes = [kms_key_id]
}
availability_zone = "eu-west-2a"
snapshot_id = length(local.application_data.accounts[local.environment].redob_snapshot_id) > 0 ? local.application_data.accounts[local.environment].redob_snapshot_id : null
size = local.application_data.accounts[local.environment].ebs_size_ebsdb_redoB
type = "io2"
iops = 3000
Expand Down Expand Up @@ -386,13 +416,14 @@ resource "aws_ebs_volume" "db_home" {
ignore_changes = [kms_key_id]
}
availability_zone = "eu-west-2a"
snapshot_id = length(local.application_data.accounts[local.environment].home_snapshot_id) > 0 ? local.application_data.accounts[local.environment].home_snapshot_id : null
size = local.application_data.accounts[local.environment].ebs_size_ebsdb_home
type = "io2"
iops = 3000
encrypted = true
kms_key_id = data.aws_kms_key.ebs_shared.key_id
tags = merge(local.tags,
{ Name = lower(format("%s-%s", local.application_data.accounts[local.environment].instance_role_ebsdb, "db-home")) },
{ Name = lower(format("%s-%s", local.application_data.accounts[local.environment].instance_role_ebsdb, "home")) },
{ device-name = "/dev/sdr" }
)
}
Expand All @@ -414,7 +445,7 @@ resource "aws_ebs_volume" "db_temp" {
encrypted = true
kms_key_id = data.aws_kms_key.ebs_shared.key_id
tags = merge(local.tags,
{ Name = lower(format("%s-%s", local.application_data.accounts[local.environment].instance_role_ebsdb, "db-temp")) },
{ Name = lower(format("%s-%s", local.application_data.accounts[local.environment].instance_role_ebsdb, "temp")) },
{ device-name = "/dev/sds" }
)
}
Expand Down

0 comments on commit 574c6a3

Please sign in to comment.