From c07395bf237e6ec9058a552d968a21713c84b881 Mon Sep 17 00:00:00 2001 From: SahidKhan89 <sahid.khan@digital.justice.gov.uk> Date: Tue, 15 Aug 2023 11:12:57 +0100 Subject: [PATCH] CC-2020: Re-design of use of AMIs --- .../ccms-ebs/application_variables.json | 28 +++++++++++++++++++ .../ccms-ebs/ccms-ec2-oracle_accessgate.tf | 2 +- .../ccms-ebs/ccms-ec2-oracle_ebs.tf | 2 +- .../ccms-ebs/ccms-ec2-oracle_ebs_apps.tf | 2 +- .../ccms-ebs/ccms-ec2-oracle_webgate.tf | 2 +- 5 files changed, 32 insertions(+), 4 deletions(-) diff --git a/terraform/environments/ccms-ebs/application_variables.json b/terraform/environments/ccms-ebs/application_variables.json index 2ce5017273f..61fd0785a6d 100644 --- a/terraform/environments/ccms-ebs/application_variables.json +++ b/terraform/environments/ccms-ebs/application_variables.json @@ -23,6 +23,13 @@ "ftp_ami_id": "ami-0d8e665f120c20253", "ec2_instance_type_clamav": "c5d.large", "clamav_ami_id": "ami-0965b5afb3ac7174e", + "ebsdb_ami_id": "ami-0df5f31cae1c86635", + "ebsapps_ami_id-1": "ami-0d4b266f7ae87bbfc", + "ebsapps_ami_id-2": "ami-0d4b266f7ae87bbfc", + "accessgate_ami_id-1": "ami-0695726199c3e30e5", + "accessgate_ami_id-2": "ami-0695726199c3e30e5", + "webgate_ami_id-1": "ami-0e398cd57c81356a7", + "webgate_ami_id-2": "ami-0e398cd57c81356a7", "restored_db_image": "ami-0df5f31cae1c86635", "orace_base_prereqs_ami_name": "Oracle79-prereqs-v2_0", "orace_db_ami_name": "Oracle79-prereqs-v1_8", @@ -93,6 +100,13 @@ "ftp_ami_id": "ami-08cd358d745620807", "ec2_instance_type_clamav": "c5d.large", "clamav_ami_id": "ami-03e88be9ecff64781", + "ebsdb_ami_id": "ami-00f388bac07735df0", + "ebsapps_ami_id-1": "ami-00f388bac07735df0", + "ebsapps_ami_id-2": "ami-00f388bac07735df0", + "accessgate_ami_id-1": "ami-0032b20a53f433208", + "accessgate_ami_id-2": "ami-0032b20a53f433208", + "webgate_ami_id-1": "ami-0a023035045d03647", + "webgate_ami_id-2": "ami-0a023035045d03647", "orace_base_prereqs_ami_name": "Oracle79-prereqs-v1_7", "orace_db_ami_name": "Oracle79-prereqs-v1_7", "orace_db_dr_ami_name": "EBSDB-DR-test", @@ -160,6 +174,13 @@ "ftp_ami_id": "ami-08cd358d745620807", "ec2_instance_type_clamav": "c5d.large", "clamav_ami_id": "ami-03e88be9ecff64781", + "ebsdb_ami_id": "ami-04631d406fcf89620", + "ebsapps_ami_id-1": "ami-04631d406fcf89620", + "ebsapps_ami_id-2": "ami-04631d406fcf89620", + "accessgate_ami_id-1": "ami-0ea936e503830d6fe", + "accessgate_ami_id-2": "ami-0ea936e503830d6fe", + "webgate_ami_id-1": "ami-021ff2a4e3544ef7b", + "webgate_ami_id-2": "ami-021ff2a4e3544ef7b", "orace_base_prereqs_ami_name": "Oracle79-prereqs-v1_8", "orace_db_ami_name": "Oracle79-prereqs-v1_8", "orace_db_dr_ami_name": "EBSDB-DR-test", @@ -227,6 +248,13 @@ "ftp_ami_id": "ami-08cd358d745620807", "ec2_instance_type_clamav": "c5d.large", "clamav_ami_id": "ami-03e88be9ecff64781", + "ebsdb_ami_id": "ami-04631d406fcf89620", + "ebsapps_ami_id-1": "ami-04631d406fcf89620", + "ebsapps_ami_id-2": "ami-04631d406fcf89620", + "accessgate_ami_id-1": "ami-0ea936e503830d6fe", + "accessgate_ami_id-2": "ami-0ea936e503830d6fe", + "webgate_ami_id-1": "ami-021ff2a4e3544ef7b", + "webgate_ami_id-2": "ami-021ff2a4e3544ef7b", "orace_base_prereqs_ami_name": "Oracle79-prereqs-v1_8", "orace_db_ami_name": "Oracle79-prereqs-v1_8", "orace_db_dr_ami_name": "EBSDB-DR-test", diff --git a/terraform/environments/ccms-ebs/ccms-ec2-oracle_accessgate.tf b/terraform/environments/ccms-ebs/ccms-ec2-oracle_accessgate.tf index 5404fd018a7..986994c0f3c 100644 --- a/terraform/environments/ccms-ebs/ccms-ec2-oracle_accessgate.tf +++ b/terraform/environments/ccms-ebs/ccms-ec2-oracle_accessgate.tf @@ -1,7 +1,7 @@ resource "aws_instance" "ec2_accessgate" { count = local.application_data.accounts[local.environment].accessgate_no_instances instance_type = local.application_data.accounts[local.environment].ec2_oracle_instance_type_accessgate - ami = data.aws_ami.accessgate.id + ami = local.application_data.accounts[local.environment]["accessgate_ami_id-${count.index + 1}"] key_name = local.application_data.accounts[local.environment].key_name vpc_security_group_ids = [aws_security_group.ec2_sg_accessgate.id] subnet_id = local.private_subnets[count.index] diff --git a/terraform/environments/ccms-ebs/ccms-ec2-oracle_ebs.tf b/terraform/environments/ccms-ebs/ccms-ec2-oracle_ebs.tf index eaf285b36f8..377867015bc 100644 --- a/terraform/environments/ccms-ebs/ccms-ec2-oracle_ebs.tf +++ b/terraform/environments/ccms-ebs/ccms-ec2-oracle_ebs.tf @@ -1,7 +1,7 @@ resource "aws_instance" "ec2_oracle_ebs" { instance_type = local.application_data.accounts[local.environment].ec2_oracle_instance_type_ebsdb #ami = data.aws_ami.oracle_db.id - ami = local.environment == "development" ? local.application_data.accounts[local.environment].restored_db_image : data.aws_ami.oracle_db.id + ami = local.application_data.accounts[local.environment].ebsdb_ami_id key_name = local.application_data.accounts[local.environment].key_name vpc_security_group_ids = [aws_security_group.ec2_sg_ebsdb.id] subnet_id = data.aws_subnet.data_subnets_a.id diff --git a/terraform/environments/ccms-ebs/ccms-ec2-oracle_ebs_apps.tf b/terraform/environments/ccms-ebs/ccms-ec2-oracle_ebs_apps.tf index a069bc2f31f..9f4ab74c0e3 100644 --- a/terraform/environments/ccms-ebs/ccms-ec2-oracle_ebs_apps.tf +++ b/terraform/environments/ccms-ebs/ccms-ec2-oracle_ebs_apps.tf @@ -1,7 +1,7 @@ resource "aws_instance" "ec2_ebsapps" { count = local.application_data.accounts[local.environment].ebsapps_no_instances instance_type = local.application_data.accounts[local.environment].ec2_oracle_instance_type_ebsapps - ami = data.aws_ami.oracle_base_prereqs.id + ami = local.application_data.accounts[local.environment]["ebsapps_ami_id-${count.index + 1}"] key_name = local.application_data.accounts[local.environment].key_name vpc_security_group_ids = [aws_security_group.ec2_sg_ebsapps.id] subnet_id = local.private_subnets[count.index] diff --git a/terraform/environments/ccms-ebs/ccms-ec2-oracle_webgate.tf b/terraform/environments/ccms-ebs/ccms-ec2-oracle_webgate.tf index f1eb5ed4ffc..396a76c0076 100644 --- a/terraform/environments/ccms-ebs/ccms-ec2-oracle_webgate.tf +++ b/terraform/environments/ccms-ebs/ccms-ec2-oracle_webgate.tf @@ -1,7 +1,7 @@ resource "aws_instance" "ec2_webgate" { count = local.application_data.accounts[local.environment].webgate_no_instances instance_type = local.application_data.accounts[local.environment].ec2_oracle_instance_type_webgate - ami = data.aws_ami.webgate.id + ami = local.application_data.accounts[local.environment]["webgate_ami_id-${count.index + 1}"] key_name = local.application_data.accounts[local.environment].key_name vpc_security_group_ids = [aws_security_group.ec2_sg_webgate.id] subnet_id = local.private_subnets[count.index]