From 37a517daadf827c0d4130d4c67d2bef6d79bbc65 Mon Sep 17 00:00:00 2001 From: Craig Gilbertson Date: Tue, 9 Apr 2024 13:11:18 +0100 Subject: [PATCH 1/7] Added windows server --- .../nomis-combined-reporting/locals_etl.tf | 10 +++--- .../locals_security_groups.tf | 31 ++++++++++++++++++- 2 files changed, 35 insertions(+), 6 deletions(-) diff --git a/terraform/environments/nomis-combined-reporting/locals_etl.tf b/terraform/environments/nomis-combined-reporting/locals_etl.tf index a1aa5423f46..2586e686545 100644 --- a/terraform/environments/nomis-combined-reporting/locals_etl.tf +++ b/terraform/environments/nomis-combined-reporting/locals_etl.tf @@ -22,12 +22,12 @@ locals { etl_ec2_default = { config = merge(module.baseline_presets.ec2_instance.config.default, { - ami_name = "base_rhel_8_5_*" - iam_resource_names_prefix = "ec2-ncr-etl" + ami_name = "hmpps_windows_server_2019_release_*" + iam_resource_names_prefix = "ec2-etl" }) instance = merge(module.baseline_presets.ec2_instance.instance.default, { instance_type = "t3.large" - vpc_security_group_ids = ["private"] + vpc_security_group_ids = ["etl"] }) user_data_cloud_init = module.baseline_presets.ec2_instance.user_data_cloud_init.ssm_agent_and_ansible @@ -41,8 +41,8 @@ locals { route53_records = module.baseline_presets.ec2_instance.route53_records.internal_and_external tags = { - description = "ncr BODS component" - ami = "base_rhel_8_5" + description = "BODS component" + ami = "windows_server_2019" os-type = "Windows" server-type = "etl" component = "etl" diff --git a/terraform/environments/nomis-combined-reporting/locals_security_groups.tf b/terraform/environments/nomis-combined-reporting/locals_security_groups.tf index 678f03b9068..c31c55c09f6 100644 --- a/terraform/environments/nomis-combined-reporting/locals_security_groups.tf +++ b/terraform/environments/nomis-combined-reporting/locals_security_groups.tf @@ -278,6 +278,35 @@ locals { } } } + etl = { + description = "Security group for etl" + ingress = { + all-within-subnet = { + description = "Allow all ingress to self" + from_port = 0 + to_port = 0 + protocol = -1 + self = true + } + http28080 = { + description = "Allow http28080 ingress" + from_port = 28080 + to_port = 28080 + protocol = "tcp" + security_groups = [] + } + } + egress = { + all = { + description = "Allow all egress" + from_port = 0 + to_port = 0 + protocol = "-1" + cidr_blocks = ["0.0.0.0/0"] + security_groups = [] + } + } + } data = { description = "Security group for data subnet" ingress = { @@ -294,7 +323,7 @@ locals { to_port = "1521" protocol = "tcp" cidr_blocks = local.security_group_cidrs.oracle_db - security_groups = ["private", "bip"] + security_groups = ["private", "bip", "etl"] } oracle3872 = { description = "Allow oem agent ingress" From 5a0fa7146107f4acf5d4973f0b6747405138f1c5 Mon Sep 17 00:00:00 2001 From: Craig Gilbertson Date: Tue, 9 Apr 2024 19:57:18 +0100 Subject: [PATCH 2/7] Added windows server --- .../nomis-combined-reporting/locals_etl.tf | 2 +- .../nomis-combined-reporting/locals_test.tf | 26 +++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/terraform/environments/nomis-combined-reporting/locals_etl.tf b/terraform/environments/nomis-combined-reporting/locals_etl.tf index 2586e686545..fb1f21ab1e8 100644 --- a/terraform/environments/nomis-combined-reporting/locals_etl.tf +++ b/terraform/environments/nomis-combined-reporting/locals_etl.tf @@ -41,7 +41,7 @@ locals { route53_records = module.baseline_presets.ec2_instance.route53_records.internal_and_external tags = { - description = "BODS component" + description = "BODS & IPS component" ami = "windows_server_2019" os-type = "Windows" server-type = "etl" diff --git a/terraform/environments/nomis-combined-reporting/locals_test.tf b/terraform/environments/nomis-combined-reporting/locals_test.tf index 06d128803e1..d907e34de84 100644 --- a/terraform/environments/nomis-combined-reporting/locals_test.tf +++ b/terraform/environments/nomis-combined-reporting/locals_test.tf @@ -148,19 +148,19 @@ locals { instance-scheduling = "skip-scheduling" }) }) - t1-ncr-etl-1-a = merge(local.etl_ec2_default, { - cloudwatch_metric_alarms = local.etl_cloudwatch_metric_alarms - config = merge(local.etl_ec2_default.config, { - instance_profile_policies = concat(local.etl_ec2_default.config.instance_profile_policies, [ - "Ec2T1ReportingPolicy", - ]) - }) - tags = merge(local.etl_ec2_default.tags, { - description = "For testing SAP BI Platform ETL installation and configurations" - nomis-combined-reporting-environment = "t1" - instance-scheduling = "skip-scheduling" - }) - }) + # t1-ncr-etl-1-a = merge(local.etl_ec2_default, { + # cloudwatch_metric_alarms = local.etl_cloudwatch_metric_alarms + # config = merge(local.etl_ec2_default.config, { + # instance_profile_policies = concat(local.etl_ec2_default.config.instance_profile_policies, [ + # "Ec2T1ReportingPolicy", + # ]) + # }) + # tags = merge(local.etl_ec2_default.tags, { + # description = "For testing SAP BI Platform ETL installation and configurations" + # nomis-combined-reporting-environment = "t1" + # instance-scheduling = "skip-scheduling" + # }) + # }) } baseline_lbs = { private = { From 73d7f561f226fa6e61926f4389a0c96195e70de6 Mon Sep 17 00:00:00 2001 From: Craig Gilbertson Date: Tue, 9 Apr 2024 21:23:14 +0100 Subject: [PATCH 3/7] Added windows server --- .../nomis-combined-reporting/locals_test.tf | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/terraform/environments/nomis-combined-reporting/locals_test.tf b/terraform/environments/nomis-combined-reporting/locals_test.tf index d907e34de84..06d128803e1 100644 --- a/terraform/environments/nomis-combined-reporting/locals_test.tf +++ b/terraform/environments/nomis-combined-reporting/locals_test.tf @@ -148,19 +148,19 @@ locals { instance-scheduling = "skip-scheduling" }) }) - # t1-ncr-etl-1-a = merge(local.etl_ec2_default, { - # cloudwatch_metric_alarms = local.etl_cloudwatch_metric_alarms - # config = merge(local.etl_ec2_default.config, { - # instance_profile_policies = concat(local.etl_ec2_default.config.instance_profile_policies, [ - # "Ec2T1ReportingPolicy", - # ]) - # }) - # tags = merge(local.etl_ec2_default.tags, { - # description = "For testing SAP BI Platform ETL installation and configurations" - # nomis-combined-reporting-environment = "t1" - # instance-scheduling = "skip-scheduling" - # }) - # }) + t1-ncr-etl-1-a = merge(local.etl_ec2_default, { + cloudwatch_metric_alarms = local.etl_cloudwatch_metric_alarms + config = merge(local.etl_ec2_default.config, { + instance_profile_policies = concat(local.etl_ec2_default.config.instance_profile_policies, [ + "Ec2T1ReportingPolicy", + ]) + }) + tags = merge(local.etl_ec2_default.tags, { + description = "For testing SAP BI Platform ETL installation and configurations" + nomis-combined-reporting-environment = "t1" + instance-scheduling = "skip-scheduling" + }) + }) } baseline_lbs = { private = { From 52dfda24e33c8f28dde6d6d4bb95faf07ae69664 Mon Sep 17 00:00:00 2001 From: Craig Gilbertson Date: Wed, 10 Apr 2024 10:50:13 +0100 Subject: [PATCH 4/7] Added windows server --- terraform/environments/nomis-combined-reporting/locals_etl.tf | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/terraform/environments/nomis-combined-reporting/locals_etl.tf b/terraform/environments/nomis-combined-reporting/locals_etl.tf index fb1f21ab1e8..ab03dbb4bf7 100644 --- a/terraform/environments/nomis-combined-reporting/locals_etl.tf +++ b/terraform/environments/nomis-combined-reporting/locals_etl.tf @@ -33,9 +33,7 @@ locals { user_data_cloud_init = module.baseline_presets.ec2_instance.user_data_cloud_init.ssm_agent_and_ansible ebs_volumes = { - "/dev/sdb" = { type = "gp3", size = 100 } - "/dev/sdc" = { type = "gp3", size = 100 } - "/dev/sds" = { type = "gp3", size = 100 } + "/dev/sda1" = { type = "gp3", size = 128 } # root volume } route53_records = module.baseline_presets.ec2_instance.route53_records.internal_and_external From 183fb0f78e177c55287eaf13c479c6e7282643f7 Mon Sep 17 00:00:00 2001 From: Craig Gilbertson Date: Wed, 10 Apr 2024 11:12:55 +0100 Subject: [PATCH 5/7] Added windows server --- .../environments/nomis-combined-reporting/locals_etl.tf | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/terraform/environments/nomis-combined-reporting/locals_etl.tf b/terraform/environments/nomis-combined-reporting/locals_etl.tf index ab03dbb4bf7..49f287dcb7e 100644 --- a/terraform/environments/nomis-combined-reporting/locals_etl.tf +++ b/terraform/environments/nomis-combined-reporting/locals_etl.tf @@ -24,6 +24,8 @@ locals { config = merge(module.baseline_presets.ec2_instance.config.default, { ami_name = "hmpps_windows_server_2019_release_*" iam_resource_names_prefix = "ec2-etl" + ebs_volumes_copy_all_from_ami = false + user_data_raw = module.baseline_presets.ec2_instance.user_data_raw["user-data-pwsh"] }) instance = merge(module.baseline_presets.ec2_instance.instance.default, { instance_type = "t3.large" @@ -33,7 +35,9 @@ locals { user_data_cloud_init = module.baseline_presets.ec2_instance.user_data_cloud_init.ssm_agent_and_ansible ebs_volumes = { - "/dev/sda1" = { type = "gp3", size = 128 } # root volume + "/dev/sdb" = { type = "gp3", size = 100 } + "/dev/sdc" = { type = "gp3", size = 100 } + "/dev/sds" = { type = "gp3", size = 100 } } route53_records = module.baseline_presets.ec2_instance.route53_records.internal_and_external From 951bfea7d63637f24aa8d30095433404e07484c2 Mon Sep 17 00:00:00 2001 From: Craig Gilbertson Date: Wed, 10 Apr 2024 11:14:18 +0100 Subject: [PATCH 6/7] Added windows server --- .../nomis-combined-reporting/locals_test.tf | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/terraform/environments/nomis-combined-reporting/locals_test.tf b/terraform/environments/nomis-combined-reporting/locals_test.tf index 06d128803e1..d907e34de84 100644 --- a/terraform/environments/nomis-combined-reporting/locals_test.tf +++ b/terraform/environments/nomis-combined-reporting/locals_test.tf @@ -148,19 +148,19 @@ locals { instance-scheduling = "skip-scheduling" }) }) - t1-ncr-etl-1-a = merge(local.etl_ec2_default, { - cloudwatch_metric_alarms = local.etl_cloudwatch_metric_alarms - config = merge(local.etl_ec2_default.config, { - instance_profile_policies = concat(local.etl_ec2_default.config.instance_profile_policies, [ - "Ec2T1ReportingPolicy", - ]) - }) - tags = merge(local.etl_ec2_default.tags, { - description = "For testing SAP BI Platform ETL installation and configurations" - nomis-combined-reporting-environment = "t1" - instance-scheduling = "skip-scheduling" - }) - }) + # t1-ncr-etl-1-a = merge(local.etl_ec2_default, { + # cloudwatch_metric_alarms = local.etl_cloudwatch_metric_alarms + # config = merge(local.etl_ec2_default.config, { + # instance_profile_policies = concat(local.etl_ec2_default.config.instance_profile_policies, [ + # "Ec2T1ReportingPolicy", + # ]) + # }) + # tags = merge(local.etl_ec2_default.tags, { + # description = "For testing SAP BI Platform ETL installation and configurations" + # nomis-combined-reporting-environment = "t1" + # instance-scheduling = "skip-scheduling" + # }) + # }) } baseline_lbs = { private = { From 8f3e72c0e869833a41028ca6983950dcb8b13119 Mon Sep 17 00:00:00 2001 From: Craig Gilbertson Date: Wed, 10 Apr 2024 14:49:07 +0100 Subject: [PATCH 7/7] Added windows server --- .../nomis-combined-reporting/locals_preproduction.tf | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/terraform/environments/nomis-combined-reporting/locals_preproduction.tf b/terraform/environments/nomis-combined-reporting/locals_preproduction.tf index 5c2960a6a5f..4a378e70f95 100644 --- a/terraform/environments/nomis-combined-reporting/locals_preproduction.tf +++ b/terraform/environments/nomis-combined-reporting/locals_preproduction.tf @@ -323,9 +323,7 @@ locals { baseline_route53_zones = { "preproduction.reporting.nomis.service.justice.gov.uk" = { records = [ - { name = "preprod-ncr", type = "CNAME", ttl = "300", records = ["t1ncr-a.preproduction.reporting.nomis.service.justice.gov.uk"] }, - { name = "preprod-ncr-a", type = "CNAME", ttl = "300", records = ["t1-ncr-db-1-a.nomis-combined-reporting.hmpps-preproduction.modernisation-platform.service.justice.gov.uk"] }, - { name = "preprod-ncr-b", type = "CNAME", ttl = "300", records = ["t1-ncr-db-1-b.nomis-combined-reporting.hmpps-preproduction.modernisation-platform.service.justice.gov.uk"] }, + { name = "db.pp.ncr.service.justice.uk", type = "CNAME", ttl = "3600", records = ["pp-ncr-db-1-a.nomis-combined-reporting.hmpps-preproduction.modernisation-platform.internal"] } ] } }