diff --git a/terraform/environments/data-platform-apps-and-tools/cloudwatch-event-rules.tf b/terraform/environments/data-platform-apps-and-tools/cloudwatch-event-rules.tf deleted file mode 100644 index 4c7bd8e8fa1..00000000000 --- a/terraform/environments/data-platform-apps-and-tools/cloudwatch-event-rules.tf +++ /dev/null @@ -1,6 +0,0 @@ -resource "aws_cloudwatch_event_rule" "jml_lambda_trigger" { - count = terraform.workspace == "data-platform-apps-and-tools-production" ? 1 : 0 - - name = "jml-lambda-trigger" - schedule_expression = "cron(0 2 1 * ? *)" -} diff --git a/terraform/environments/data-platform-apps-and-tools/cloudwatch-event-targets.tf b/terraform/environments/data-platform-apps-and-tools/cloudwatch-event-targets.tf deleted file mode 100644 index a7cd1a490a3..00000000000 --- a/terraform/environments/data-platform-apps-and-tools/cloudwatch-event-targets.tf +++ /dev/null @@ -1,7 +0,0 @@ -resource "aws_cloudwatch_event_target" "jml_lambda_trigger" { - count = terraform.workspace == "data-platform-apps-and-tools-production" ? 1 : 0 - - rule = aws_cloudwatch_event_rule.jml_lambda_trigger[0].name - target_id = "jml-lambda-trigger" - arn = module.jml_extract_lambda[0].lambda_function_arn -} diff --git a/terraform/environments/data-platform-apps-and-tools/data.tf b/terraform/environments/data-platform-apps-and-tools/data.tf index ac3e45e1363..0672166494a 100644 --- a/terraform/environments/data-platform-apps-and-tools/data.tf +++ b/terraform/environments/data-platform-apps-and-tools/data.tf @@ -82,19 +82,3 @@ data "aws_secretsmanager_secret_version" "openmetadata_entra_id_client_id" { data "aws_secretsmanager_secret_version" "openmetadata_entra_id_tenant_id" { secret_id = "openmetadata/entra-id/tenant-id" } - -################################################## -# Data Platform Apps and Tools JML -################################################## - -data "aws_secretsmanager_secret_version" "govuk_notify_api_key" { - count = terraform.workspace == "data-platform-apps-and-tools-production" ? 1 : 0 - - secret_id = aws_secretsmanager_secret.govuk_notify_api_key[0].id -} - -data "aws_secretsmanager_secret_version" "jml_email" { - count = terraform.workspace == "data-platform-apps-and-tools-production" ? 1 : 0 - - secret_id = aws_secretsmanager_secret.jml_email[0].id -} diff --git a/terraform/environments/data-platform-apps-and-tools/lambda-functions.tf b/terraform/environments/data-platform-apps-and-tools/lambda-functions.tf deleted file mode 100644 index c78a1a6afae..00000000000 --- a/terraform/environments/data-platform-apps-and-tools/lambda-functions.tf +++ /dev/null @@ -1,65 +0,0 @@ -module "jml_extract_lambda" { - #checkov:skip=CKV_TF_1:Module is from Terraform registry - count = terraform.workspace == "data-platform-apps-and-tools-production" ? 1 : 0 - - source = "terraform-aws-modules/lambda/aws" - version = "~> 6.0" - - publish = true - create_package = false - - function_name = "data_platform_jml_extract" - description = "Generates a JML report and sends it to JMLv4" - package_type = "Image" - memory_size = 512 - timeout = 120 - image_uri = "374269020027.dkr.ecr.eu-west-2.amazonaws.com/data-platform-jml-extract-lambda-ecr-repo:1.0.3" - - environment_variables = { - SECRET_ID = data.aws_secretsmanager_secret_version.govuk_notify_api_key[0].id - LOG_GROUP_NAMES = module.auth0_log_streams["alpha-analytics-moj"].cloudwatch_log_group_name - EMAIL_SECRET = data.aws_secretsmanager_secret_version.jml_email[0].id - TEMPLATE_ID = "de618989-db86-4d9a-aa55-4724d5485fa5" - } - - attach_policy_statements = true - policy_statements = { - "cloudwatch" = { - sid = "CloudWatch" - effect = "Allow" - actions = [ - "cloudwatch:GenerateQuery", - "logs:DescribeLogStreams", - "logs:DescribeLogGroups", - "logs:GetLogEvents", - "logs:StartQuery", - "logs:StopQuery", - "logs:GetQueryExecution", - "logs:GetQueryResults" - ] - resources = [ - "${module.auth0_log_streams["alpha-analytics-moj"].cloudwatch_log_group_arn}:*" - ] - } - "secretsmanager" = { - sid = "SecretsManager" - effect = "Allow" - actions = [ - "secretsmanager:DescribeSecret", - "secretsmanager:GetSecretValue", - "secretsmanager:ListSecrets" - ] - resources = [ - aws_secretsmanager_secret.govuk_notify_api_key[0].arn, - aws_secretsmanager_secret.jml_email[0].arn - ] - } - } - - allowed_triggers = { - "eventbridge" = { - principal = "events.amazonaws.com" - source_arn = aws_cloudwatch_event_rule.jml_lambda_trigger[0].arn - } - } -} diff --git a/terraform/environments/data-platform-apps-and-tools/secrets.tf b/terraform/environments/data-platform-apps-and-tools/secrets.tf index 6b85dcdadb2..2162ce78455 100644 --- a/terraform/environments/data-platform-apps-and-tools/secrets.tf +++ b/terraform/environments/data-platform-apps-and-tools/secrets.tf @@ -34,16 +34,3 @@ resource "aws_secretsmanager_secret" "github_app_arc_private_key" { name = "github/arc/private-key" } -# Create a new secret in AWS SecretsManager for Gov.UK Notify API key -resource "aws_secretsmanager_secret" "govuk_notify_api_key" { - count = terraform.workspace == "data-platform-apps-and-tools-production" ? 1 : 0 - - name = "gov-uk-notify/production/api-key" -} - -# Email secret for Lambda function -resource "aws_secretsmanager_secret" "jml_email" { - count = terraform.workspace == "data-platform-apps-and-tools-production" ? 1 : 0 - - name = "jml/email" -}