diff --git a/terraform/environments/hmpps-oem/locals.tf b/terraform/environments/hmpps-oem/locals.tf index 373fa46d8af..804568d39af 100644 --- a/terraform/environments/hmpps-oem/locals.tf +++ b/terraform/environments/hmpps-oem/locals.tf @@ -226,5 +226,4 @@ locals { } cloudwatch_monitoring_options = local.environment_cloudwatch_monitoring_options[local.environment] - } diff --git a/terraform/environments/hmpps-oem/main.tf b/terraform/environments/hmpps-oem/main.tf index 7b841933d8d..13622f2c71e 100644 --- a/terraform/environments/hmpps-oem/main.tf +++ b/terraform/environments/hmpps-oem/main.tf @@ -164,7 +164,6 @@ module "baseline" { } module "cloudwatch_dashboard" { - source = "./modules/cloudwatch" + source = "./modules/cloudwatch_dashboard" options = local.cloudwatch_monitoring_options } - diff --git a/terraform/environments/hmpps-oem/modules/cloudwatch/dashboard.tf b/terraform/environments/hmpps-oem/modules/cloudwatch_dashboard/dashboard.tf similarity index 100% rename from terraform/environments/hmpps-oem/modules/cloudwatch/dashboard.tf rename to terraform/environments/hmpps-oem/modules/cloudwatch_dashboard/dashboard.tf diff --git a/terraform/environments/hmpps-oem/modules/cloudwatch/oam.tf b/terraform/environments/hmpps-oem/modules/cloudwatch_dashboard/oam.tf similarity index 100% rename from terraform/environments/hmpps-oem/modules/cloudwatch/oam.tf rename to terraform/environments/hmpps-oem/modules/cloudwatch_dashboard/oam.tf diff --git a/terraform/environments/hmpps-oem/modules/cloudwatch/variables.tf b/terraform/environments/hmpps-oem/modules/cloudwatch_dashboard/variables.tf similarity index 76% rename from terraform/environments/hmpps-oem/modules/cloudwatch/variables.tf rename to terraform/environments/hmpps-oem/modules/cloudwatch_dashboard/variables.tf index f412fb5ef11..924ffcea6dc 100644 --- a/terraform/environments/hmpps-oem/modules/cloudwatch/variables.tf +++ b/terraform/environments/hmpps-oem/modules/cloudwatch_dashboard/variables.tf @@ -1,6 +1,6 @@ variable "source_account_ids" { type = list(string) - default = ["612659970365", "546088120047"] + default = ["612659970365", "546088120047"] #nomis-test and oasys-test } variable "options" { diff --git a/terraform/environments/nomis/cloudwatch_dashboard/oam.tf b/terraform/environments/nomis/cloudwatch_dashboard/oam.tf index 069c5ed3f97..e93a12cb919 100644 --- a/terraform/environments/nomis/cloudwatch_dashboard/oam.tf +++ b/terraform/environments/nomis/cloudwatch_dashboard/oam.tf @@ -1,6 +1,5 @@ - resource "aws_oam_link" "source_account_oam_link" { - count = var.options.enable_hmpps-oem_monitoring ? 1 : 0 + count = var.options.enable_hmpps-oem_monitoring ? 1 : 0 label_template = "nomis" resource_types = ["AWS::CloudWatch::Metric"] sink_identifier = var.monitoring_account_sink_identifier @@ -33,8 +32,8 @@ data "aws_iam_policy" "policy" { } resource "aws_iam_role" "aws_cloudwatch_metrics_role" { - count = var.options.enable_hmpps-oem_monitoring ? 1 : 0 - name = "CloudWatch-CrossAccountSharingRole" + count = var.options.enable_hmpps-oem_monitoring ? 1 : 0 + name = "CloudWatch-CrossAccountSharingRole" assume_role_policy = jsonencode(local.policy) } @@ -44,5 +43,5 @@ resource "aws_iam_role_policy_attachment" "policy" { if var.options.enable_hmpps-oem_monitoring ]) policy_arn = data.aws_iam_policy.policy[each.key].arn - role = aws_iam_role.aws_cloudwatch_metrics_role[0].name + role = aws_iam_role.aws_cloudwatch_metrics_role[0].name } diff --git a/terraform/environments/nomis/cloudwatch_dashboard/variables.tf b/terraform/environments/nomis/cloudwatch_dashboard/variables.tf index 4dd05f4ec06..fd20cbabcdf 100644 --- a/terraform/environments/nomis/cloudwatch_dashboard/variables.tf +++ b/terraform/environments/nomis/cloudwatch_dashboard/variables.tf @@ -1,10 +1,10 @@ variable "monitoring_account_sink_identifier" { - type = string + type = string default = "arn:aws:oam:eu-west-2:775245656481:sink/c2161e14-4683-4d84-ae2e-1eb7385e715b" } variable "monitoring_account_id" { - type = string + type = string default = "775245656481" # hmpps-oem-test account } @@ -13,4 +13,4 @@ variable "options" { type = object({ enable_hmpps-oem_monitoring = optional(bool, false) }) -} \ No newline at end of file +} diff --git a/terraform/environments/nomis/locals.tf b/terraform/environments/nomis/locals.tf index a6fb9129d73..482f90a1db2 100644 --- a/terraform/environments/nomis/locals.tf +++ b/terraform/environments/nomis/locals.tf @@ -188,5 +188,4 @@ locals { } cloudwatch_monitoring_options = local.environment_cloudwatch_monitoring_options[local.environment] - } diff --git a/terraform/environments/oasys/cloudwatch_dashboard/oam.tf b/terraform/environments/oasys/cloudwatch_dashboard/oam.tf index b7b23c978b6..4668dad5f98 100644 --- a/terraform/environments/oasys/cloudwatch_dashboard/oam.tf +++ b/terraform/environments/oasys/cloudwatch_dashboard/oam.tf @@ -1,6 +1,5 @@ - resource "aws_oam_link" "source_account_oam_link" { - count = var.options.enable_hmpps-oem_monitoring ? 1 : 0 + count = var.options.enable_hmpps-oem_monitoring ? 1 : 0 label_template = "oasys" resource_types = ["AWS::CloudWatch::Metric"] sink_identifier = var.monitoring_account_sink_identifier @@ -33,8 +32,8 @@ data "aws_iam_policy" "policy" { } resource "aws_iam_role" "aws_cloudwatch_metrics_role" { - count = var.options.enable_hmpps-oem_monitoring ? 1 : 0 - name = "CloudWatch-CrossAccountSharingRole" + count = var.options.enable_hmpps-oem_monitoring ? 1 : 0 + name = "CloudWatch-CrossAccountSharingRole" assume_role_policy = jsonencode(local.policy) } @@ -44,5 +43,5 @@ resource "aws_iam_role_policy_attachment" "policy" { if var.options.enable_hmpps-oem_monitoring ]) policy_arn = data.aws_iam_policy.policy[each.key].arn - role = aws_iam_role.aws_cloudwatch_metrics_role[0].name + role = aws_iam_role.aws_cloudwatch_metrics_role[0].name } diff --git a/terraform/environments/oasys/cloudwatch_dashboard/variables.tf b/terraform/environments/oasys/cloudwatch_dashboard/variables.tf index 8bcacfef8c7..fd20cbabcdf 100644 --- a/terraform/environments/oasys/cloudwatch_dashboard/variables.tf +++ b/terraform/environments/oasys/cloudwatch_dashboard/variables.tf @@ -1,10 +1,10 @@ variable "monitoring_account_sink_identifier" { - type = string + type = string default = "arn:aws:oam:eu-west-2:775245656481:sink/c2161e14-4683-4d84-ae2e-1eb7385e715b" } variable "monitoring_account_id" { - type = string + type = string default = "775245656481" # hmpps-oem-test account } diff --git a/terraform/environments/oasys/locals.tf b/terraform/environments/oasys/locals.tf index ff5c9554bdd..9e07e50307e 100644 --- a/terraform/environments/oasys/locals.tf +++ b/terraform/environments/oasys/locals.tf @@ -471,5 +471,4 @@ locals { } cloudwatch_monitoring_options = local.environment_cloudwatch_monitoring_options[local.environment] - }