diff --git a/terraform/environments/apex/application_variables.json b/terraform/environments/apex/application_variables.json index 51bf4c2a484..de2d6ea8d1a 100644 --- a/terraform/environments/apex/application_variables.json +++ b/terraform/environments/apex/application_variables.json @@ -6,7 +6,15 @@ "ec2instancetype": "t3.medium", "mp_vpc_cidr": "10.26.56.0/21", "lz_shared_nonprod_mgmt_vpc_cidr": "10.200.0.0/20", - "lz_shared_prod_mgmt_vpc_cidr": "10.200.16.0/20" + "lz_shared_prod_mgmt_vpc_cidr": "10.200.16.0/20", + "u01_orahome_size": "40", + "u01_orahome_snapshot": "snap-0fb84db7af842db4b", + "u02_oradata_size": "100", + "u02_oradata_snapshot": "snap-002a82aef2628b621", + "u03_redo_size": "50", + "u03_redo_snapshot": "snap-08499cdd392b9b7dc", + "u04_arch_size": "50", + "u04_arch_snapshot": "snap-03b6eb947cfe779d8" }, "test": { "example_var": "test-data" diff --git a/terraform/environments/apex/ec2.tf b/terraform/environments/apex/ec2.tf index b7ad12b1934..b53950c0125 100644 --- a/terraform/environments/apex/ec2.tf +++ b/terraform/environments/apex/ec2.tf @@ -29,7 +29,7 @@ resource "aws_instance" "apex_db_instance" { volume_type = "gp2" tags = merge( local.tags, - { "Name" = "${local.application_name}-root-volume" }, + { "Name" = "${local.application_name}db-ec2-root" }, ) } @@ -146,29 +146,89 @@ resource "aws_iam_role_policy" "ec2_instance_policy" { }) } -# resource "aws_ebs_volume" "EC2ServerVolumeORAHOME" { -# availability_zone = "eu-west-2a" -# size = local.application_data.accounts[local.environment].orahomesize -# type = "gp3" -# encrypted = true -# kms_key_id = data.aws_kms_key.ebs_shared.key_id -# snapshot_id = local.application_data.accounts[local.environment].orahome_snapshot +resource "aws_ebs_volume" "u01-orahome" { + availability_zone = "eu-west-2a" + size = local.application_data.accounts[local.environment].u01_orahome_size + type = "gp3" + encrypted = true + kms_key_id = data.aws_kms_key.ebs_shared.key_id + snapshot_id = local.application_data.accounts[local.environment].u01_orahome_snapshot + lifecycle { + ignore_changes = [kms_key_id] + } + tags = merge( + local.tags, + { "Name" = "${local.application_name}db-ec2-u01-orahome" }, + ) +} +resource "aws_volume_attachment" "u01-orahome" { + device_name = "/dev/sdb" + volume_id = aws_ebs_volume.u01-orahome.id + instance_id = aws_instance.apex_db_instance.id +} -# lifecycle { -# ignore_changes = [kms_key_id] -# } +resource "aws_ebs_volume" "u02-oradata" { + availability_zone = "eu-west-2a" + size = local.application_data.accounts[local.environment].u02_oradata_size + type = "gp3" + encrypted = true + kms_key_id = data.aws_kms_key.ebs_shared.key_id + snapshot_id = local.application_data.accounts[local.environment].u02_oradata_snapshot + lifecycle { + ignore_changes = [kms_key_id] + } + tags = merge( + local.tags, + { "Name" = "${local.application_name}db-ec2-u02-oradata" }, + ) +} +resource "aws_volume_attachment" "u02-oradata" { + device_name = "/dev/sdc" + volume_id = aws_ebs_volume.u02-oradata.id + instance_id = aws_instance.apex_db_instance.id +} -# tags = merge( -# local.tags, -# { "Name" = "${local.application_name}-EC2ServerVolumeORAHOME" }, -# ) -# } +resource "aws_ebs_volume" "u03-redo" { + availability_zone = "eu-west-2a" + size = local.application_data.accounts[local.environment].u03_redo_size + type = "gp3" + encrypted = true + kms_key_id = data.aws_kms_key.ebs_shared.key_id + snapshot_id = local.application_data.accounts[local.environment].u03_redo_snapshot + lifecycle { + ignore_changes = [kms_key_id] + } + tags = merge( + local.tags, + { "Name" = "${local.application_name}db-ec2-u03-redo" }, + ) +} +resource "aws_volume_attachment" "u03-redo" { + device_name = "/dev/sdd" + volume_id = aws_ebs_volume.u03-redo.id + instance_id = aws_instance.apex_db_instance.id +} -# resource "aws_volume_attachment" "oas_EC2ServerVolume01" { -# device_name = "/dev/sdb" -# volume_id = aws_ebs_volume.EC2ServerVolumeORAHOME.id -# instance_id = aws_instance.oas_app_instance.id -# } +resource "aws_ebs_volume" "u04-arch" { + availability_zone = "eu-west-2a" + size = local.application_data.accounts[local.environment].u04_arch_size + type = "gp3" + encrypted = true + kms_key_id = data.aws_kms_key.ebs_shared.key_id + snapshot_id = local.application_data.accounts[local.environment].u04_arch_snapshot + lifecycle { + ignore_changes = [kms_key_id] + } + tags = merge( + local.tags, + { "Name" = "${local.application_name}db-ec2-u04-arch" }, + ) +} +resource "aws_volume_attachment" "u04-arch" { + device_name = "/dev/sde" + volume_id = aws_ebs_volume.u04-arch.id + instance_id = aws_instance.apex_db_instance.id +} resource "aws_route53_record" "apex-db" { provider = aws.core-vpc