diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f6c8f3..0721735 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,16 @@ All notable changes to this project will be documented in this file. +## [2.0.2] - 2024-08-15 + +### 🐛 Bug Fixes + +- Refactor code to correct the name and description of some resources. +- Refactor code to correct comments, description, variable names and list of keys to drop from 'details' key. +- Refactor code to correct the variable names and indentation. +- Refactor code to correct the variable names. +- Refactor code to correct the name, description, tags and/or TF resource names of some resources, some variable names, list of AWS services under Principal in AWS SNS topic policy and logic to get the list of all AWS Lambda functions excluding 'aws-alerts-lambda-function'. + ## [2.0.1] - 2024-07-04 ### 🐛 Bug Fixes @@ -12,6 +22,7 @@ All notable changes to this project will be documented in this file. - Update README.md to add examples of AWS Alerts on Slack as notifications - Add 'code.zip' in .gitignore +- *(release)* Prepare Release for v2.0.1. ## [2.0.0] - 2024-07-04 diff --git a/VERSION b/VERSION index 0ac852d..f3b15f3 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v2.0.1 +v2.0.2 diff --git a/cloudformation/aws_alerts_cft.yaml b/cloudformation/aws_alerts_cft.yaml index 359e1f9..62af3c9 100644 --- a/cloudformation/aws_alerts_cft.yaml +++ b/cloudformation/aws_alerts_cft.yaml @@ -751,10 +751,10 @@ Resources: - AWSAlertsSNSTopic Condition: CreateCBFailureResources Properties: - Name: cb-failure-cloudwatch-event + Name: aws-alerts-codebuild-failure-cloudwatch-event Description: >- AWS CloudWatch Event to send alerts on AWS SNS regarding AWS - CodeBuild Failures. + CodeBuild failures. EventPattern: source: - aws.codebuild @@ -790,10 +790,10 @@ Resources: - AWSAlertsSNSTopic Condition: CreateEC2AutoScalingFailureResources Properties: - Name: ec2-autoscaling-failure-cloudwatch-event + Name: aws-alerts-ec2-autoscaling-failure-cloudwatch-event Description: >- AWS CloudWatch Event to send alerts on AWS SNS regarding AWS EC2 - Auto Scaling Failures. + Auto Scaling failures. EventPattern: source: - aws.autoscaling @@ -827,10 +827,10 @@ Resources: - AWSAlertsSNSTopic Condition: CreateBatchFailureResources Properties: - Name: batch-failure-cloudwatch-event + Name: aws-alerts-batch-failure-cloudwatch-event Description: >- AWS CloudWatch Event to send alerts on AWS SNS regarding AWS Batch - Failures. + failures. EventPattern: source: - aws.batch @@ -866,10 +866,10 @@ Resources: - AWSAlertsSNSTopic Condition: CreateCodeDeployFailureResources Properties: - Name: codedeploy-failure-cloudwatch-event + Name: aws-alerts-codedeploy-failure-cloudwatch-event Description: >- AWS CloudWatch Event to send alerts on AWS SNS regarding AWS - CodeDeploy Failures. + CodeDeploy failures. EventPattern: source: - aws.codedeploy @@ -906,10 +906,10 @@ Resources: - AWSAlertsSNSTopic Condition: CreateCodePipelineFailureResources Properties: - Name: codepipeline-failure-cloudwatch-event + Name: aws-alerts-codepipeline-failure-cloudwatch-event Description: >- AWS CloudWatch Event to send alerts on AWS SNS regarding AWS - CodePipeline Failures. + CodePipeline failures. EventPattern: source: - aws.codepipeline @@ -946,10 +946,10 @@ Resources: - AWSAlertsSNSTopic Condition: CreateConfigFailureResources Properties: - Name: config-failure-cloudwatch-event + Name: aws-alerts-config-failure-cloudwatch-event Description: >- AWS CloudWatch Event to send alerts on AWS SNS regarding AWS - Config Failures. + Config failures. EventPattern: source: - aws.config @@ -985,10 +985,10 @@ Resources: - AWSAlertsSNSTopic Condition: CreateEBSFailureResources Properties: - Name: ebs-failure-cloudwatch-event + Name: aws-alerts-ebs-failure-cloudwatch-event Description: >- AWS CloudWatch Event to send alerts on AWS SNS regarding AWS EBS - Failures. + failures. EventPattern: source: - aws.ec2 @@ -1034,10 +1034,10 @@ Resources: - AWSAlertsSNSTopic Condition: CreateGlueFailureResources Properties: - Name: glue-failure-cloudwatch-event + Name: aws-alerts-glue-failure-cloudwatch-event Description: >- AWS CloudWatch Event to send alerts on AWS SNS regarding AWS Glue - Failures. + failures. EventPattern: source: - aws.glue @@ -1075,10 +1075,10 @@ Resources: - AWSAlertsSNSTopic Condition: CreateEMRFailureResources Properties: - Name: emr-failure-cloudwatch-event + Name: aws-alerts-emr-failure-cloudwatch-event Description: >- AWS CloudWatch Event to send alerts on AWS SNS regarding AWS EMR - Failures. + failures. EventPattern: source: - aws.emr @@ -1121,7 +1121,7 @@ Resources: - AWSAlertsSNSTopic Condition: CreateEMRErrorResources Properties: - Name: emr-error-cloudwatch-event + Name: aws-alerts-emr-error-cloudwatch-event Description: >- AWS CloudWatch Event to send alerts on AWS SNS regarding AWS EMR Errors. @@ -1157,7 +1157,7 @@ Resources: - AWSAlertsSNSTopic Condition: CreateECSInstanceTerminationResources Properties: - Name: ecs-instance-termination-cloudwatch-event + Name: aws-alerts-ecs-instance-termination-cloudwatch-event Description: >- AWS CloudWatch Event to send alerts on AWS SNS regarding AWS ECS Instance Terminations. @@ -1196,7 +1196,7 @@ Resources: - AWSAlertsSNSTopic Condition: CreateECSTaskTerminationResources Properties: - Name: ecs-task-termination-cloudwatch-event + Name: aws-alerts-ecs-task-termination-cloudwatch-event Description: >- AWS CloudWatch Event to send alerts on AWS SNS regarding AWS ECS Task Terminations. @@ -1235,7 +1235,7 @@ Resources: - AWSAlertsSNSTopic Condition: CreateEC2InstanceTerminationResources Properties: - Name: ec2-instance-termination-cloudwatch-event + Name: aws-alerts-ec2-instance-termination-cloudwatch-event Description: >- AWS CloudWatch Event to send alerts on AWS SNS regarding AWS EC2 Instance Terminations. @@ -1275,7 +1275,7 @@ Resources: - AWSAlertsSNSTopic Condition: CreateEC2SpotInstanceErrorResources Properties: - Name: ec2-spot-instance-error-cloudwatch-event + Name: aws-alerts-ec2-spot-instance-error-cloudwatch-event Description: >- AWS CloudWatch Event to send alerts on AWS SNS regarding AWS EC2 Spot Instance Errors. @@ -1311,7 +1311,7 @@ Resources: - AWSAlertsSNSTopic Condition: CreateTrustedAdvisorErrorWarningResources Properties: - Name: trusted-advisor-error-warning-cloudwatch-event + Name: aws-alerts-trusted-advisor-error-warning-cloudwatch-event Description: >- AWS CloudWatch Event to send alerts on AWS SNS regarding AWS Trusted Advisor Errors and Warnings. @@ -1351,7 +1351,7 @@ Resources: - AWSAlertsSNSTopic Condition: CreateHealthErrorResources Properties: - Name: health-error-cloudwatch-event + Name: aws-alerts-health-error-cloudwatch-event Description: >- AWS CloudWatch Event to send alerts on AWS SNS regarding AWS Health Errors. @@ -1391,10 +1391,10 @@ Resources: - AWSAlertsSNSTopic Condition: CreateSMSFailureResources Properties: - Name: sms-failure-cloudwatch-event + Name: aws-alerts-sms-failure-cloudwatch-event Description: >- AWS CloudWatch Event to send alerts on AWS SNS regarding AWS SMS - Failures. + failures. EventPattern: source: - aws.sms @@ -1430,10 +1430,10 @@ Resources: - AWSAlertsSNSTopic Condition: CreateStepFunctionsFailureResources Properties: - Name: step-functions-failure-cloudwatch-event + Name: aws-alerts-step-functions-failure-cloudwatch-event Description: >- AWS CloudWatch Event to send alerts on AWS SNS regarding AWS Step - Functions Failures. + Functions failures. EventPattern: source: - aws.states @@ -1471,10 +1471,10 @@ Resources: - AWSAlertsSNSTopic Condition: CreateSSMMaintainanceWindowFailureResources Properties: - Name: ssm-maintainance-window-failure-cloudwatch-event + Name: aws-alerts-ssm-maintainance-window-failure-cloudwatch-event Description: >- AWS CloudWatch Event to send alerts on AWS SNS regarding AWS SSM - Maintainance Window Failures. + Maintainance Window failures. EventPattern: source: - aws.ssm @@ -1514,10 +1514,10 @@ Resources: - AWSAlertsSNSTopic Condition: CreateSSMEC2FailureResources Properties: - Name: ssm-ec2-failure-cloudwatch-event + Name: aws-alerts-ssm-ec2-failure-cloudwatch-event Description: >- AWS CloudWatch Event to send alerts on AWS SNS regarding AWS SSM - EC2 State Manager, Run Command and Automation Failures. + EC2 State Manager, Run Command and Automation failures. EventPattern: source: - aws.ssm @@ -1560,7 +1560,7 @@ Resources: - AWSAlertsSNSTopic Condition: CreateSSMComplianceWarningResources Properties: - Name: ssm-compliance-warning-cloudwatch-event + Name: aws-alerts-ssm-compliance-warning-cloudwatch-event Description: >- AWS CloudWatch Event to send alerts on AWS SNS regarding AWS SSM Compliance Warnings. @@ -1599,10 +1599,10 @@ Resources: - AWSAlertsSNSTopic Condition: CreateOpsWorksFailureResources Properties: - Name: opsworks-failure-cloudwatch-event + Name: aws-alerts-opsworks-failure-cloudwatch-event Description: >- AWS CloudWatch Event to send alerts on AWS SNS regarding AWS - OpsWorks Failures. + OpsWorks failures. EventPattern: source: - aws.opsworks @@ -1649,7 +1649,7 @@ Resources: - AWSAlertsSNSTopic Condition: CreateOpsWorksErrorResources Properties: - Name: opsworks-error-cloudwatch-event + Name: aws-alerts-opsworks-error-cloudwatch-event Description: >- AWS CloudWatch Event to send alerts on AWS SNS regarding AWS OpsWorks Errors. @@ -1685,7 +1685,7 @@ Resources: - AWSAlertsSNSTopic Condition: CreateKMSKeyExpirationWarningResources Properties: - Name: kms-key-expiration-warning-cloudwatch-event + Name: aws-alerts-kms-key-expiration-warning-cloudwatch-event Description: >- AWS CloudWatch Event to send alerts on AWS SNS regarding AWS KMS Key Expiration Warnings. @@ -1721,7 +1721,7 @@ Resources: - AWSAlertsSNSTopic Condition: CreateMacieWarningResources Properties: - Name: macie-warning-cloudwatch-event + Name: aws-alerts-macie-warning-cloudwatch-event Description: >- AWS CloudWatch Event to send alerts on AWS SNS regarding AWS Macie Warnings. @@ -1757,10 +1757,10 @@ Resources: - AWSAlertsSNSTopic Condition: CreateGameLiftFailureResources Properties: - Name: gamelift-failure-cloudwatch-event + Name: aws-alerts-gamelift-failure-cloudwatch-event Description: >- AWS CloudWatch Event to send alerts on AWS SNS regarding AWS - GameLift Failures. + GameLift failures. EventPattern: source: - aws.gamelift @@ -1798,10 +1798,10 @@ Resources: - AWSAlertsSNSTopic Condition: CreateTranscribeFailureResources Properties: - Name: transcribe-failure-cloudwatch-event + Name: aws-alerts-transcribe-failure-cloudwatch-event Description: >- AWS CloudWatch Event to send alerts on AWS SNS regarding AWS - Transcribe Failures. + Transcribe failures. EventPattern: source: - aws.transcribe @@ -1837,10 +1837,10 @@ Resources: - AWSAlertsSNSTopic Condition: CreateSignerFailureResources Properties: - Name: signer-failure-cloudwatch-event + Name: aws-alerts-signer-failure-cloudwatch-event Description: >- AWS CloudWatch Event to send alerts on AWS SNS regarding AWS - Signer Failures. + Signer failures. EventPattern: source: - aws.signer @@ -1876,7 +1876,7 @@ Resources: - AWSAlertsSNSTopic Condition: CreateDataSyncErrorWarningResources Properties: - Name: datasync-error-warning-cloudwatch-event + Name: aws-alerts-datasync-error-warning-cloudwatch-event Description: >- AWS CloudWatch Event to send alerts on AWS SNS regarding AWS DataSync Errors and Warnings. @@ -1919,10 +1919,10 @@ Resources: - AWSAlertsSNSTopic Condition: CreateIoTAnalyticsFailureResources Properties: - Name: iot-analytics-failure-cloudwatch-event + Name: aws-alerts-iot-analytics-failure-cloudwatch-event Description: >- AWS CloudWatch Event to send alerts on AWS SNS regarding AWS IoT - Analytics Failures. + Analytics failures. EventPattern: source: - aws.iotanalytics @@ -1958,7 +1958,7 @@ Resources: - AWSAlertsSNSTopic Condition: CreateDataLifecycleManagerErrorResources Properties: - Name: data-lifecycle-manager-error-cloudwatch-event + Name: aws-alerts-data-lifecycle-manager-error-cloudwatch-event Description: >- AWS CloudWatch Event to send alerts on AWS SNS regarding AWS Data Lifecycle Manager Errors. @@ -1997,7 +1997,7 @@ Resources: - AWSAlertsSNSTopic Condition: CreateElementalMediaPackageErrorResources Properties: - Name: elemental-mediapackage-error-cloudwatch-event + Name: aws-alerts-elemental-mediapackage-error-cloudwatch-event Description: >- AWS CloudWatch Event to send alerts on AWS SNS regarding AWS Elemental MediaPackage Errors. @@ -2039,7 +2039,7 @@ Resources: - AWSAlertsSNSTopic Condition: CreateElementalMediaLiveErrorResources Properties: - Name: elemental-medialive-error-cloudwatch-event + Name: aws-alerts-elemental-medialive-error-cloudwatch-event Description: >- AWS CloudWatch Event to send alerts on AWS SNS regarding AWS Elemental MediaLive Errors. @@ -2075,7 +2075,7 @@ Resources: - AWSAlertsSNSTopic Condition: CreateElementalMediaConvertErrorResources Properties: - Name: elemental-mediaconvert-error-cloudwatch-event + Name: aws-alerts-elemental-mediaconvert-error-cloudwatch-event Description: >- AWS CloudWatch Event to send alerts on AWS SNS regarding AWS Elemental MediaConvert Errors. @@ -2114,10 +2114,10 @@ Resources: - AWSAlertsSNSTopic Condition: CreateSageMakerHyperParameterTuningFailureResources Properties: - Name: sagemaker-hyperparameter-tuning-failure-cloudwatch-event + Name: aws-alerts-sagemaker-hyperparameter-failure-cloudwatch-event Description: >- AWS CloudWatch Event to send alerts on AWS SNS regarding AWS - SageMaker HyperParameter Tuning Failures. + SageMaker HyperParameter Tuning Job failures. EventPattern: source: - aws.sagemaker @@ -2153,10 +2153,10 @@ Resources: - AWSAlertsSNSTopic Condition: CreateSageMakerTransformFailureResources Properties: - Name: sagemaker-transform-failure-cloudwatch-event + Name: aws-alerts-sagemaker-transform-failure-cloudwatch-event Description: >- AWS CloudWatch Event to send alerts on AWS SNS regarding AWS - SageMaker Transform Failures. + SageMaker Transform Job failures. EventPattern: source: - aws.sagemaker @@ -2192,10 +2192,10 @@ Resources: - AWSAlertsSNSTopic Condition: CreateSageMakerTrainingFailureResources Properties: - Name: sagemaker-training-failure-cloudwatch-event + Name: aws-alerts-sagemaker-training-failure-cloudwatch-event Description: >- AWS CloudWatch Event to send alerts on AWS SNS regarding AWS - SageMaker Training Failures. + SageMaker Training Job failures. EventPattern: source: - aws.sagemaker diff --git a/function/aws_alerts_lambda_function.py b/function/aws_alerts_lambda_function.py index a276af0..e5d4ba9 100644 --- a/function/aws_alerts_lambda_function.py +++ b/function/aws_alerts_lambda_function.py @@ -1,8 +1,10 @@ #!/usr/bin/python -"""Python script to be used by an AWS Lambda function to send alerts to AWS SNS topic.""" +""" +Python script to be used by an AWS Lambda function to send alerts to AWS SNS topic. +""" -# Required imports +# required imports import os import sys import json @@ -30,16 +32,16 @@ def lambda_handler(event, context): )['Parameter']['Value'] print("Extracting data from the event and formatting it...") - event_subject = str(event['Records'][0]['Sns']['Subject']) + event_title = str(event['Records'][0]['Sns']['Subject']) event_message = str(event['Records'][0]['Sns']['Message']) event_message_json = json.loads(event_message) - if event_subject == "None": + if event_title == "None": if 'name' in event_message_json and 'region' in event_message_json: event_name = str(event_message_json['name']) event_region = str(event_message_json['region']) - event_subject = f"EVENT: '{event_name}' in {event_region}" + event_title = f"EVENT: '{event_name}' in {event_region}" else: - event_subject = "EVENT" + event_title = "EVENT" keys_to_remove = [ 'AlarmActions', 'AlarmConfigurationUpdatedTimestamp', @@ -70,11 +72,14 @@ def lambda_handler(event, context): keys_to_remove_from_details = [ 'ActivityId', 'additional-information', + 'communicationId', 'current-phase-context', 'current-phase', 'EndTime', + 'page', 'RequestId', 'StartTime', + 'totalPages,', 'version' ] if 'details' in event_message_json and isinstance(event_message_json['details'], dict): @@ -84,11 +89,11 @@ def lambda_handler(event, context): event_message_formatted = f"```{json.dumps(event_message_json, indent=4)}```" print("Sending the alert to Slack...") - slack_data = { + slack_message = { "attachments": [ { "pretext": "*AWS Alert*", - "title": f":warning: Alert: {event_subject}", + "title": f":warning: Alert: {event_title}", "text": f":exclamation: *Description:* {event_message_formatted}", "color": "#ff0000" } @@ -97,7 +102,7 @@ def lambda_handler(event, context): try: response = requests.post( slack_webhook_url, - data=json.dumps(slack_data), + data=json.dumps(slack_message), headers={'Content-Type': "application/json"}, timeout=10) response.raise_for_status() diff --git a/terraform-usage-example.tf b/terraform-usage-example.tf index 1e2e89f..94a7bea 100644 --- a/terraform-usage-example.tf +++ b/terraform-usage-example.tf @@ -27,33 +27,33 @@ module "aws-alerts" { enable_kms_key_expiration_warning_alerts = true # Disabled - enable_dms_failure_warning_alerts = false - enable_redshift_error_alerts = false - enable_code_build_failure_alerts = false - enable_batch_failure_alerts = false - enable_code_deploy_failure_alerts = false - enable_code_pipeline_failure_alerts = false - enable_glue_failure_alerts = false - enable_emr_failure_alerts = false - enable_emr_error_alerts = false - enable_ecs_instance_termination_alerts = false - enable_ecs_task_termination_alerts = false - enable_ec2_instance_termination_alerts = false - enable_sms_failure_alerts = false - enable_step_functions_failure_alerts = false - enable_ops_works_failure_alerts = false - enable_ops_works_error_alerts = false - enable_macie_warning_alerts = false - enable_game_lift_failure_alerts = false - enable_transcribe_failure_alerts = false - enable_signer_failure_alerts = false - enable_data_sync_error_warning_alerts = false - enable_iot_analytics_failure_alerts = false - enable_data_lifecycle_manager_error_alerts = false - enable_elemental_media_package_error_alerts = false - enable_elemental_media_live_error_alerts = false - enable_elemental_media_convert_error_alerts = false - enable_sage_maker_hyper_parameter_tuning_failure_alerts = false - enable_sage_maker_transform_failure_alerts = false - enable_sage_maker_training_failure_alerts = false + enable_dms_failure_warning_alerts = false + enable_redshift_error_alerts = false + enable_code_build_failure_alerts = false + enable_batch_failure_alerts = false + enable_code_deploy_failure_alerts = false + enable_code_pipeline_failure_alerts = false + enable_glue_failure_alerts = false + enable_emr_failure_alerts = false + enable_emr_error_alerts = false + enable_ecs_instance_termination_alerts = false + enable_ecs_task_termination_alerts = false + enable_ec2_instance_termination_alerts = false + enable_sms_failure_alerts = false + enable_step_functions_failure_alerts = false + enable_ops_works_failure_alerts = false + enable_ops_works_error_alerts = false + enable_macie_warning_alerts = false + enable_game_lift_failure_alerts = false + enable_transcribe_failure_alerts = false + enable_signer_failure_alerts = false + enable_data_sync_error_warning_alerts = false + enable_iot_analytics_failure_alerts = false + enable_data_lifecycle_manager_error_alerts = false + enable_elemental_media_package_error_alerts = false + enable_elemental_media_live_error_alerts = false + enable_elemental_media_convert_error_alerts = false + enable_sagemaker_hyperparameter_failure_alerts = false + enable_sagemaker_transform_failure_alerts = false + enable_sagemaker_training_failure_alerts = false } diff --git a/terraform/main.tf b/terraform/main.tf index c0f076e..783eb7d 100644 --- a/terraform/main.tf +++ b/terraform/main.tf @@ -5,7 +5,8 @@ data "aws_lambda_functions" "all" {} data "aws_region" "current" {} locals { - lambda_function_names = length(var.lambda_function_names) == 0 ? data.aws_lambda_functions.all.function_names : var.lambda_function_names + all_lambda_function_names = tolist(setsubtract(data.aws_lambda_functions.all.function_names, ["aws-alerts-lambda-function"])) + lambda_function_names = length(var.lambda_function_names) == 0 ? local.all_lambda_function_names : var.lambda_function_names lambda_function_build_command = "pip3 install -r ${path.module}/../function/requirements.txt -t ${path.module}/../function --no-cache-dir --upgrade" } @@ -49,11 +50,11 @@ resource "aws_sns_topic_policy" "aws_alerts_sns_topic_policy" { Effect = "Allow" Principal = { Service = [ + "cloudwatch.amazonaws.com", "datapipeline.amazonaws.com", "dms.amazonaws.com", "events.amazonaws.com", "lambda.amazonaws.com", - "cloudwatch.amazonaws.com", "monitoring.rds.amazonaws.com", "rds.amazonaws.com", "s3.amazonaws.com" @@ -177,11 +178,11 @@ resource "aws_lambda_permission" "lambda_invoke_permission" { source_arn = aws_sns_topic.aws_alerts_sns_topic.id } -resource "aws_cloudwatch_metric_alarm" "lambda_failure_cloud_watch_alarm" { +resource "aws_cloudwatch_metric_alarm" "lambda_function_failure_cloudwatch_alarm" { count = var.enable_lambda_failure_alerts ? length(local.lambda_function_names) : 0 - alarm_name = "aws-alerts-lambda-function-${local.lambda_function_names[count.index]}-failure-alarm" - alarm_description = "AWS CloudWatch Alarm to send alerts on AWS SNS regarding AWS Lambda function failures for '${local.lambda_function_names[count.index]}' function." + alarm_name = "aws-alerts-lambda-function-failure-alarm-${count.index}" + alarm_description = "AWS CloudWatch alarm to send alerts on AWS SNS regarding AWS Lambda function '${local.lambda_function_names[count.index]}' failures." namespace = "AWS/Lambda" metric_name = "Errors" comparison_operator = "GreaterThanOrEqualToThreshold" @@ -200,9 +201,9 @@ resource "aws_cloudwatch_metric_alarm" "lambda_failure_cloud_watch_alarm" { ] } -resource "aws_dms_event_subscription" "dms_instance_failure_event" { +resource "aws_dms_event_subscription" "dms_instance_failure_warning_event" { count = var.enable_dms_failure_warning_alerts ? 1 : 0 - name = "dms-instance-failure-warning-event" + name = "aws-alerts-dms-instance-failure-warning-event" event_categories = [ "failure", "low storage", @@ -212,13 +213,13 @@ resource "aws_dms_event_subscription" "dms_instance_failure_event" { sns_topic_arn = aws_sns_topic.aws_alerts_sns_topic.id source_type = "replication-instance" tags = { - Name = "dms-instance-failure-event" + Name = "aws-alerts-dms-instance-failure-warning-event" } } resource "aws_dms_event_subscription" "dms_task_failure_event" { count = var.enable_dms_failure_warning_alerts ? 1 : 0 - name = "dms-task-failure-event" + name = "aws-alerts-dms-task-failure-event" event_categories = [ "failure", "deletion" @@ -226,13 +227,13 @@ resource "aws_dms_event_subscription" "dms_task_failure_event" { sns_topic_arn = aws_sns_topic.aws_alerts_sns_topic.id source_type = "replication-task" tags = { - Name = "dms-task-failure-event" + Name = "aws-alerts-dms-task-failure-event" } } resource "aws_db_event_subscription" "db_instance_failure_warning_event" { count = var.enable_rds_failure_warning_alerts ? 1 : 0 - name = "aws-rds-event-subscription-db-instance-failure-warning-event" + name = "aws-alerts-rds-db-instance-failure-warning-event" sns_topic = aws_sns_topic.aws_alerts_sns_topic.arn source_type = "db-instance" @@ -245,7 +246,7 @@ resource "aws_db_event_subscription" "db_instance_failure_warning_event" { resource "aws_db_event_subscription" "db_security_group_failure_warning_event" { count = var.enable_rds_failure_warning_alerts ? 1 : 0 - name = "aws-rds-event-subscription-db-security-group-failure-warning-event" + name = "aws-alerts-rds-db-security-group-failure-warning-event" sns_topic = aws_sns_topic.aws_alerts_sns_topic.arn source_type = "db-security-group" @@ -256,7 +257,7 @@ resource "aws_db_event_subscription" "db_security_group_failure_warning_event" { resource "aws_db_event_subscription" "db_cluster_failure_warning_event" { count = var.enable_rds_failure_warning_alerts ? 1 : 0 - name = "aws-rds-event-subscription-db-cluster-failure-warning-event" + name = "aws-alerts-rds-db-cluster-failure-warning-event" sns_topic = aws_sns_topic.aws_alerts_sns_topic.arn source_type = "db-cluster" @@ -269,7 +270,7 @@ resource "aws_db_event_subscription" "db_cluster_failure_warning_event" { resource "aws_db_event_subscription" "custom_engine_version_failure_warning_event" { count = var.enable_rds_failure_warning_alerts ? 1 : 0 - name = "aws-rds-event-subscription-custom-engine-version-failure-warning-event" + name = "aws-alerts-rds-custom-engine-version-failure-warning-event" sns_topic = aws_sns_topic.aws_alerts_sns_topic.arn source_type = "custom-engine-version" @@ -280,7 +281,7 @@ resource "aws_db_event_subscription" "custom_engine_version_failure_warning_even resource "aws_db_event_subscription" "blue_green_deployment_failure_warning_event" { count = var.enable_rds_failure_warning_alerts ? 1 : 0 - name = "aws-rds-event-subscription-blue-green-deployment-failure-warning-event" + name = "aws-alerts-rds-blue-green-deployment-failure-warning-event" sns_topic = aws_sns_topic.aws_alerts_sns_topic.arn source_type = "blue-green-deployment" @@ -291,7 +292,7 @@ resource "aws_db_event_subscription" "blue_green_deployment_failure_warning_even resource "aws_redshift_event_subscription" "cluster_error_event" { count = var.enable_redshift_error_alerts ? 1 : 0 - name = "aws-redshift-event-subscription-cluster-error-event" + name = "aws-alerts-redshift-cluster-error-event" sns_topic_arn = aws_sns_topic.aws_alerts_sns_topic.arn source_type = "cluster" severity = "ERROR" @@ -299,7 +300,7 @@ resource "aws_redshift_event_subscription" "cluster_error_event" { resource "aws_redshift_event_subscription" "cluster_parameter_group_error_event" { count = var.enable_redshift_error_alerts ? 1 : 0 - name = "aws-redshift-event-subscription-cluster-parameter-group-error-event" + name = "aws-alerts-redshift-cluster-parameter-group-error-event" sns_topic_arn = aws_sns_topic.aws_alerts_sns_topic.arn source_type = "cluster-parameter-group" severity = "ERROR" @@ -307,7 +308,7 @@ resource "aws_redshift_event_subscription" "cluster_parameter_group_error_event" resource "aws_redshift_event_subscription" "cluster_security_group_error_event" { count = var.enable_redshift_error_alerts ? 1 : 0 - name = "aws-redshift-event-subscription-cluster-security-group-error-event" + name = "aws-alerts-redshift-cluster-security-group-error-event" sns_topic_arn = aws_sns_topic.aws_alerts_sns_topic.arn source_type = "cluster-security-group" severity = "ERROR" @@ -315,7 +316,7 @@ resource "aws_redshift_event_subscription" "cluster_security_group_error_event" resource "aws_redshift_event_subscription" "cluster_snapshot_error_event" { count = var.enable_redshift_error_alerts ? 1 : 0 - name = "aws-redshift-event-subscription-cluster-snapshot-error-event" + name = "aws-alerts-redshift-cluster-snapshot-error-event" sns_topic_arn = aws_sns_topic.aws_alerts_sns_topic.arn source_type = "cluster-snapshot" severity = "ERROR" @@ -323,16 +324,16 @@ resource "aws_redshift_event_subscription" "cluster_snapshot_error_event" { resource "aws_redshift_event_subscription" "scheduled_action_error_event" { count = var.enable_redshift_error_alerts ? 1 : 0 - name = "aws-redshift-event-subscription-scheduled-action-error-event" + name = "aws-alerts-redshift-scheduled-action-error-event" sns_topic_arn = aws_sns_topic.aws_alerts_sns_topic.arn source_type = "scheduled-action" severity = "ERROR" } -resource "aws_cloudwatch_event_rule" "cb_failure_cloud_watch_event" { +resource "aws_cloudwatch_event_rule" "codebuild_failure_cloudwatch_event" { count = var.enable_code_build_failure_alerts ? 1 : 0 - name = "cb-failure-cloudwatch-event" - description = "AWS CloudWatch Event to send alerts on AWS SNS regarding AWS CodeBuild Failures." + name = "aws-alerts-codebuild-failure-cloudwatch-event" + description = "AWS CloudWatch event to send alerts on AWS SNS regarding AWS CodeBuild failures." event_pattern = jsonencode({ source = [ "aws.codebuild" @@ -348,9 +349,9 @@ resource "aws_cloudwatch_event_rule" "cb_failure_cloud_watch_event" { }) } -resource "aws_cloudwatch_event_target" "cb_failure_cloud_watch_event_target" { +resource "aws_cloudwatch_event_target" "codebuild_failure_cloudwatch_event_target" { count = var.enable_code_build_failure_alerts ? 1 : 0 - rule = aws_cloudwatch_event_rule.cb_failure_cloud_watch_event[0].name + rule = aws_cloudwatch_event_rule.codebuild_failure_cloudwatch_event[0].name target_id = "FailurealertSNSTopicTarget" arn = aws_sns_topic.aws_alerts_sns_topic.id input_transformer { @@ -377,10 +378,10 @@ EOF } } -resource "aws_cloudwatch_event_rule" "ec2_auto_scaling_failure_cloud_watch_event" { +resource "aws_cloudwatch_event_rule" "ec2_auto_scaling_failure_cloudwatch_event" { count = var.enable_ec2_auto_scaling_failure_alerts ? 1 : 0 - name = "ec2-autoscaling-failure-cloudwatch-event" - description = "AWS CloudWatch Event to send alerts on AWS SNS regarding AWS EC2 Auto Scaling Failures." + name = "aws-alerts-ec2-autoscaling-failure-cloudwatch-event" + description = "AWS CloudWatch event to send alerts on AWS SNS regarding AWS EC2 Auto Scaling failures." event_pattern = jsonencode({ source = [ "aws.autoscaling" @@ -392,9 +393,9 @@ resource "aws_cloudwatch_event_rule" "ec2_auto_scaling_failure_cloud_watch_event }) } -resource "aws_cloudwatch_event_target" "ec2_auto_scaling_failure_cloud_watch_event_target" { +resource "aws_cloudwatch_event_target" "ec2_auto_scaling_failure_cloudwatch_event_target" { count = var.enable_ec2_auto_scaling_failure_alerts ? 1 : 0 - rule = aws_cloudwatch_event_rule.ec2_auto_scaling_failure_cloud_watch_event[0].name + rule = aws_cloudwatch_event_rule.ec2_auto_scaling_failure_cloudwatch_event[0].name target_id = "FailurealertSNSTopicTarget" arn = aws_sns_topic.aws_alerts_sns_topic.id input_transformer { @@ -421,10 +422,10 @@ EOF } } -resource "aws_cloudwatch_event_rule" "batch_failure_cloud_watch_event" { +resource "aws_cloudwatch_event_rule" "batch_failure_cloudwatch_event" { count = var.enable_batch_failure_alerts ? 1 : 0 - name = "batch-failure-cloudwatch-event" - description = "AWS CloudWatch Event to send alerts on AWS SNS regarding AWS Batch Failures." + name = "aws-alerts-batch-failure-cloudwatch-event" + description = "AWS CloudWatch event to send alerts on AWS SNS regarding AWS Batch failures." event_pattern = jsonencode({ source = [ "aws.batch" @@ -440,9 +441,9 @@ resource "aws_cloudwatch_event_rule" "batch_failure_cloud_watch_event" { }) } -resource "aws_cloudwatch_event_target" "batch_failure_cloud_watch_event_target" { +resource "aws_cloudwatch_event_target" "batch_failure_cloudwatch_event_target" { count = var.enable_batch_failure_alerts ? 1 : 0 - rule = aws_cloudwatch_event_rule.batch_failure_cloud_watch_event[0].name + rule = aws_cloudwatch_event_rule.batch_failure_cloudwatch_event[0].name target_id = "FailurealertSNSTopicTarget" arn = aws_sns_topic.aws_alerts_sns_topic.id input_transformer { @@ -469,10 +470,10 @@ resource "aws_cloudwatch_event_target" "batch_failure_cloud_watch_event_target" } } -resource "aws_cloudwatch_event_rule" "code_deploy_failure_cloud_watch_event" { +resource "aws_cloudwatch_event_rule" "code_deploy_failure_cloudwatch_event" { count = var.enable_code_deploy_failure_alerts ? 1 : 0 - name = "codedeploy-failure-cloudwatch-event" - description = "AWS CloudWatch Event to send alerts on AWS SNS regarding AWS CodeDeploy Failures." + name = "aws-alerts-codedeploy-failure-cloudwatch-event" + description = "AWS CloudWatch event to send alerts on AWS SNS regarding AWS CodeDeploy failures." event_pattern = jsonencode({ source = [ "aws.codedeploy" @@ -489,9 +490,9 @@ resource "aws_cloudwatch_event_rule" "code_deploy_failure_cloud_watch_event" { }) } -resource "aws_cloudwatch_event_target" "code_deploy_failure_cloud_watch_event_target" { +resource "aws_cloudwatch_event_target" "code_deploy_failure_cloudwatch_event_target" { count = var.enable_code_deploy_failure_alerts ? 1 : 0 - rule = aws_cloudwatch_event_rule.code_deploy_failure_cloud_watch_event[0].name + rule = aws_cloudwatch_event_rule.code_deploy_failure_cloudwatch_event[0].name target_id = "FailurealertSNSTopicTarget" arn = aws_sns_topic.aws_alerts_sns_topic.id input_transformer { @@ -518,10 +519,10 @@ resource "aws_cloudwatch_event_target" "code_deploy_failure_cloud_watch_event_ta } } -resource "aws_cloudwatch_event_rule" "code_pipeline_failure_cloud_watch_event" { +resource "aws_cloudwatch_event_rule" "code_pipeline_failure_cloudwatch_event" { count = var.enable_code_pipeline_failure_alerts ? 1 : 0 - name = "codepipeline-failure-cloudwatch-event" - description = "AWS CloudWatch Event to send alerts on AWS SNS regarding AWS CodePipeline Failures." + name = "aws-alerts-codepipeline-failure-cloudwatch-event" + description = "AWS CloudWatch event to send alerts on AWS SNS regarding AWS CodePipeline failures." event_pattern = jsonencode({ source = [ "aws.codepipeline" @@ -538,9 +539,9 @@ resource "aws_cloudwatch_event_rule" "code_pipeline_failure_cloud_watch_event" { }) } -resource "aws_cloudwatch_event_target" "code_pipeline_failure_cloud_watch_event_target" { +resource "aws_cloudwatch_event_target" "code_pipeline_failure_cloudwatch_event_target" { count = var.enable_code_pipeline_failure_alerts ? 1 : 0 - rule = aws_cloudwatch_event_rule.code_pipeline_failure_cloud_watch_event[0].name + rule = aws_cloudwatch_event_rule.code_pipeline_failure_cloudwatch_event[0].name target_id = "FailurealertSNSTopicTarget" arn = aws_sns_topic.aws_alerts_sns_topic.id input_transformer { @@ -567,10 +568,10 @@ resource "aws_cloudwatch_event_target" "code_pipeline_failure_cloud_watch_event_ } } -resource "aws_cloudwatch_event_rule" "config_failure_cloud_watch_event" { +resource "aws_cloudwatch_event_rule" "config_failure_cloudwatch_event" { count = var.enable_config_failure_alerts ? 1 : 0 - name = "config-failure-cloudwatch-event" - description = "AWS CloudWatch Event to send alerts on AWS SNS regarding AWS Config Failures." + name = "aws-alerts-config-failure-cloudwatch-event" + description = "AWS CloudWatch event to send alerts on AWS SNS regarding AWS Config failures." event_pattern = jsonencode({ source = [ "aws.config" @@ -586,9 +587,9 @@ resource "aws_cloudwatch_event_rule" "config_failure_cloud_watch_event" { }) } -resource "aws_cloudwatch_event_target" "config_failure_cloud_watch_event_target" { +resource "aws_cloudwatch_event_target" "config_failure_cloudwatch_event_target" { count = var.enable_config_failure_alerts ? 1 : 0 - rule = aws_cloudwatch_event_rule.config_failure_cloud_watch_event[0].name + rule = aws_cloudwatch_event_rule.config_failure_cloudwatch_event[0].name target_id = "FailurealertSNSTopicTarget" arn = aws_sns_topic.aws_alerts_sns_topic.id input_transformer { @@ -615,10 +616,10 @@ resource "aws_cloudwatch_event_target" "config_failure_cloud_watch_event_target" } } -resource "aws_cloudwatch_event_rule" "ebs_failure_cloud_watch_event" { +resource "aws_cloudwatch_event_rule" "ebs_failure_cloudwatch_event" { count = var.enable_ebs_failure_alerts ? 1 : 0 - name = "ebs-failure-cloudwatch-event" - description = "AWS CloudWatch Event to send alerts on AWS SNS regarding AWS EBS Failures." + name = "aws-alerts-ebs-failure-cloudwatch-event" + description = "AWS CloudWatch event to send alerts on AWS SNS regarding AWS EBS failures." event_pattern = jsonencode({ source = [ "aws.ec2" @@ -645,9 +646,9 @@ resource "aws_cloudwatch_event_rule" "ebs_failure_cloud_watch_event" { }) } -resource "aws_cloudwatch_event_target" "ebs_failure_cloud_watch_event_target" { +resource "aws_cloudwatch_event_target" "ebs_failure_cloudwatch_event_target" { count = var.enable_ebs_failure_alerts ? 1 : 0 - rule = aws_cloudwatch_event_rule.ebs_failure_cloud_watch_event[0].name + rule = aws_cloudwatch_event_rule.ebs_failure_cloudwatch_event[0].name target_id = "FailurealertSNSTopicTarget" arn = aws_sns_topic.aws_alerts_sns_topic.id input_transformer { @@ -674,10 +675,10 @@ resource "aws_cloudwatch_event_target" "ebs_failure_cloud_watch_event_target" { } } -resource "aws_cloudwatch_event_rule" "glue_failure_cloud_watch_event" { +resource "aws_cloudwatch_event_rule" "glue_failure_cloudwatch_event" { count = var.enable_glue_failure_alerts ? 1 : 0 - name = "glue-failure-cloudwatch-event" - description = "AWS CloudWatch Event to send alerts on AWS SNS regarding AWS Glue Failures." + name = "aws-alerts-glue-failure-cloudwatch-event" + description = "AWS CloudWatch event to send alerts on AWS SNS regarding AWS Glue failures." event_pattern = jsonencode({ source = [ "aws.glue" @@ -695,9 +696,9 @@ resource "aws_cloudwatch_event_rule" "glue_failure_cloud_watch_event" { }) } -resource "aws_cloudwatch_event_target" "glue_failure_cloud_watch_event_target" { +resource "aws_cloudwatch_event_target" "glue_failure_cloudwatch_event_target" { count = var.enable_glue_failure_alerts ? 1 : 0 - rule = aws_cloudwatch_event_rule.glue_failure_cloud_watch_event[0].name + rule = aws_cloudwatch_event_rule.glue_failure_cloudwatch_event[0].name target_id = "FailurealertSNSTopicTarget" arn = aws_sns_topic.aws_alerts_sns_topic.id input_transformer { @@ -724,10 +725,10 @@ resource "aws_cloudwatch_event_target" "glue_failure_cloud_watch_event_target" { } } -resource "aws_cloudwatch_event_rule" "emr_failure_cloud_watch_event" { +resource "aws_cloudwatch_event_rule" "emr_failure_cloudwatch_event" { count = var.enable_emr_failure_alerts ? 1 : 0 - name = "emr-failure-cloudwatch-event" - description = "AWS CloudWatch Event to send alerts on AWS SNS regarding AWS EMR Failures." + name = "aws-alerts-emr-failure-cloudwatch-event" + description = "AWS CloudWatch event to send alerts on AWS SNS regarding AWS EMR failures." event_pattern = jsonencode({ source = [ "aws.emr" @@ -750,9 +751,9 @@ resource "aws_cloudwatch_event_rule" "emr_failure_cloud_watch_event" { }) } -resource "aws_cloudwatch_event_target" "emr_failure_cloud_watch_event_target" { +resource "aws_cloudwatch_event_target" "emr_failure_cloudwatch_event_target" { count = var.enable_emr_failure_alerts ? 1 : 0 - rule = aws_cloudwatch_event_rule.emr_failure_cloud_watch_event[0].name + rule = aws_cloudwatch_event_rule.emr_failure_cloudwatch_event[0].name target_id = "FailurealertSNSTopicTarget" arn = aws_sns_topic.aws_alerts_sns_topic.id input_transformer { @@ -779,10 +780,10 @@ resource "aws_cloudwatch_event_target" "emr_failure_cloud_watch_event_target" { } } -resource "aws_cloudwatch_event_rule" "emr_error_cloud_watch_event" { +resource "aws_cloudwatch_event_rule" "emr_error_cloudwatch_event" { count = var.enable_emr_error_alerts ? 1 : 0 - name = "emr-error-cloudwatch-event" - description = "AWS CloudWatch Event to send alerts on AWS SNS regarding AWS EMR Errors." + name = "aws-alerts-emr-error-cloudwatch-event" + description = "AWS CloudWatch event to send alerts on AWS SNS regarding AWS EMR Errors." event_pattern = jsonencode({ source = [ "aws.emr" @@ -793,9 +794,9 @@ resource "aws_cloudwatch_event_rule" "emr_error_cloud_watch_event" { }) } -resource "aws_cloudwatch_event_target" "emr_error_cloud_watch_event_target" { +resource "aws_cloudwatch_event_target" "emr_error_cloudwatch_event_target" { count = var.enable_emr_error_alerts ? 1 : 0 - rule = aws_cloudwatch_event_rule.emr_error_cloud_watch_event[0].name + rule = aws_cloudwatch_event_rule.emr_error_cloudwatch_event[0].name target_id = "FailurealertSNSTopicTarget" arn = aws_sns_topic.aws_alerts_sns_topic.id input_transformer { @@ -822,10 +823,10 @@ resource "aws_cloudwatch_event_target" "emr_error_cloud_watch_event_target" { } } -resource "aws_cloudwatch_event_rule" "ecs_instance_termination_cloud_watch_event" { +resource "aws_cloudwatch_event_rule" "ecs_instance_termination_cloudwatch_event" { count = var.enable_ecs_instance_termination_alerts ? 1 : 0 - name = "ecs-instance-termination-cloudwatch-event" - description = "AWS CloudWatch Event to send alerts on AWS SNS regarding AWS ECS Instance Terminations." + name = "aws-alerts-ecs-instance-termination-cloudwatch-event" + description = "AWS CloudWatch event to send alerts on AWS SNS regarding AWS ECS Instance Terminations." event_pattern = jsonencode({ source = [ "aws.ecs" @@ -841,9 +842,9 @@ resource "aws_cloudwatch_event_rule" "ecs_instance_termination_cloud_watch_event }) } -resource "aws_cloudwatch_event_target" "ecs_instance_termination_cloud_watch_event_target" { +resource "aws_cloudwatch_event_target" "ecs_instance_termination_cloudwatch_event_target" { count = var.enable_ecs_instance_termination_alerts ? 1 : 0 - rule = aws_cloudwatch_event_rule.ecs_instance_termination_cloud_watch_event[0].name + rule = aws_cloudwatch_event_rule.ecs_instance_termination_cloudwatch_event[0].name target_id = "FailurealertSNSTopicTarget" arn = aws_sns_topic.aws_alerts_sns_topic.id input_transformer { @@ -870,10 +871,10 @@ resource "aws_cloudwatch_event_target" "ecs_instance_termination_cloud_watch_eve } } -resource "aws_cloudwatch_event_rule" "ecs_task_termination_cloud_watch_event" { +resource "aws_cloudwatch_event_rule" "ecs_task_termination_cloudwatch_event" { count = var.enable_ecs_task_termination_alerts ? 1 : 0 - name = "ecs-task-termination-cloudwatch-event" - description = "AWS CloudWatch Event to send alerts on AWS SNS regarding AWS ECS Task Terminations." + name = "aws-alerts-ecs-task-termination-cloudwatch-event" + description = "AWS CloudWatch event to send alerts on AWS SNS regarding AWS ECS Task Terminations." event_pattern = jsonencode({ source = [ "aws.ecs" @@ -889,9 +890,9 @@ resource "aws_cloudwatch_event_rule" "ecs_task_termination_cloud_watch_event" { }) } -resource "aws_cloudwatch_event_target" "ecs_task_termination_cloud_watch_event_target" { +resource "aws_cloudwatch_event_target" "ecs_task_termination_cloudwatch_event_target" { count = var.enable_ecs_task_termination_alerts ? 1 : 0 - rule = aws_cloudwatch_event_rule.ecs_task_termination_cloud_watch_event[0].name + rule = aws_cloudwatch_event_rule.ecs_task_termination_cloudwatch_event[0].name target_id = "FailurealertSNSTopicTarget" arn = aws_sns_topic.aws_alerts_sns_topic.id input_transformer { @@ -918,10 +919,10 @@ resource "aws_cloudwatch_event_target" "ecs_task_termination_cloud_watch_event_t } } -resource "aws_cloudwatch_event_rule" "ec2_instance_termination_cloud_watch_event" { +resource "aws_cloudwatch_event_rule" "ec2_instance_termination_cloudwatch_event" { count = var.enable_ec2_instance_termination_alerts ? 1 : 0 - name = "ec2-instance-termination-cloudwatch-event" - description = "AWS CloudWatch Event to send alerts on AWS SNS regarding AWS EC2 Instance Terminations." + name = "aws-alerts-ec2-instance-termination-cloudwatch-event" + description = "AWS CloudWatch event to send alerts on AWS SNS regarding AWS EC2 Instance Terminations." event_pattern = jsonencode({ source = [ "aws.ec2" @@ -938,9 +939,9 @@ resource "aws_cloudwatch_event_rule" "ec2_instance_termination_cloud_watch_event }) } -resource "aws_cloudwatch_event_target" "ec2_instance_termination_cloud_watch_event_target" { +resource "aws_cloudwatch_event_target" "ec2_instance_termination_cloudwatch_event_target" { count = var.enable_ec2_instance_termination_alerts ? 1 : 0 - rule = aws_cloudwatch_event_rule.ec2_instance_termination_cloud_watch_event[0].name + rule = aws_cloudwatch_event_rule.ec2_instance_termination_cloudwatch_event[0].name target_id = "FailurealertSNSTopicTarget" arn = aws_sns_topic.aws_alerts_sns_topic.id input_transformer { @@ -967,10 +968,10 @@ resource "aws_cloudwatch_event_target" "ec2_instance_termination_cloud_watch_eve } } -resource "aws_cloudwatch_event_rule" "ec2_spot_instance_error_cloud_watch_event" { +resource "aws_cloudwatch_event_rule" "ec2_spot_instance_error_cloudwatch_event" { count = var.enable_ec2_spot_instance_error_alerts ? 1 : 0 - name = "ec2-spot-instance-error-cloudwatch-event" - description = "AWS CloudWatch Event to send alerts on AWS SNS regarding AWS EC2 Spot Instance Errors." + name = "aws-alerts-ec2-spot-instance-error-cloudwatch-event" + description = "AWS CloudWatch event to send alerts on AWS SNS regarding AWS EC2 Spot Instance Errors." event_pattern = jsonencode({ source = [ "aws.ec2" @@ -981,9 +982,9 @@ resource "aws_cloudwatch_event_rule" "ec2_spot_instance_error_cloud_watch_event" }) } -resource "aws_cloudwatch_event_target" "ec2_spot_instance_error_cloud_watch_event_target" { +resource "aws_cloudwatch_event_target" "ec2_spot_instance_error_cloudwatch_event_target" { count = var.enable_ec2_spot_instance_error_alerts ? 1 : 0 - rule = aws_cloudwatch_event_rule.ec2_spot_instance_error_cloud_watch_event[0].name + rule = aws_cloudwatch_event_rule.ec2_spot_instance_error_cloudwatch_event[0].name target_id = "FailurealertSNSTopicTarget" arn = aws_sns_topic.aws_alerts_sns_topic.id input_transformer { @@ -1010,10 +1011,10 @@ resource "aws_cloudwatch_event_target" "ec2_spot_instance_error_cloud_watch_even } } -resource "aws_cloudwatch_event_rule" "trusted_advisor_error_warning_cloud_watch_event" { +resource "aws_cloudwatch_event_rule" "trusted_advisor_error_warning_cloudwatch_event" { count = var.enable_trusted_advisor_error_warning_alerts ? 1 : 0 - name = "trusted-advisor-error-warning-cloudwatch-event" - description = "AWS CloudWatch Event to send alerts on AWS SNS regarding AWS Trusted Advisor Errors and Warnings." + name = "aws-alerts-trusted-advisor-error-warning-cloudwatch-event" + description = "AWS CloudWatch event to send alerts on AWS SNS regarding AWS Trusted Advisor Errors and Warnings." event_pattern = jsonencode({ source = [ "aws.trustedadvisor" @@ -1030,9 +1031,9 @@ resource "aws_cloudwatch_event_rule" "trusted_advisor_error_warning_cloud_watch_ }) } -resource "aws_cloudwatch_event_target" "trusted_advisor_error_warning_cloud_watch_event_target" { +resource "aws_cloudwatch_event_target" "trusted_advisor_error_warning_cloudwatch_event_target" { count = var.enable_trusted_advisor_error_warning_alerts ? 1 : 0 - rule = aws_cloudwatch_event_rule.trusted_advisor_error_warning_cloud_watch_event[0].name + rule = aws_cloudwatch_event_rule.trusted_advisor_error_warning_cloudwatch_event[0].name target_id = "FailurealertSNSTopicTarget" arn = aws_sns_topic.aws_alerts_sns_topic.id input_transformer { @@ -1059,10 +1060,10 @@ resource "aws_cloudwatch_event_target" "trusted_advisor_error_warning_cloud_watc } } -resource "aws_cloudwatch_event_rule" "health_error_cloud_watch_event" { +resource "aws_cloudwatch_event_rule" "health_error_cloudwatch_event" { count = var.enable_health_error_alerts ? 1 : 0 - name = "health-error-cloudwatch-event" - description = "AWS CloudWatch Event to send alerts on AWS SNS regarding AWS Health Errors." + name = "aws-alerts-health-error-cloudwatch-event" + description = "AWS CloudWatch event to send alerts on AWS SNS regarding AWS Health Errors." event_pattern = jsonencode({ source = [ "aws.health" @@ -1079,9 +1080,9 @@ resource "aws_cloudwatch_event_rule" "health_error_cloud_watch_event" { }) } -resource "aws_cloudwatch_event_target" "health_error_cloud_watch_event_target" { +resource "aws_cloudwatch_event_target" "health_error_cloudwatch_event_target" { count = var.enable_health_error_alerts ? 1 : 0 - rule = aws_cloudwatch_event_rule.health_error_cloud_watch_event[0].name + rule = aws_cloudwatch_event_rule.health_error_cloudwatch_event[0].name target_id = "FailurealertSNSTopicTarget" arn = aws_sns_topic.aws_alerts_sns_topic.id input_transformer { @@ -1108,10 +1109,10 @@ resource "aws_cloudwatch_event_target" "health_error_cloud_watch_event_target" { } } -resource "aws_cloudwatch_event_rule" "sms_failure_cloud_watch_event" { +resource "aws_cloudwatch_event_rule" "sms_failure_cloudwatch_event" { count = var.enable_sms_failure_alerts ? 1 : 0 - name = "sms-failure-cloudwatch-event" - description = "AWS CloudWatch Event to send alerts on AWS SNS regarding AWS SMS Failures." + name = "aws-alerts-sms-failure-cloudwatch-event" + description = "AWS CloudWatch event to send alerts on AWS SNS regarding AWS SMS failures." event_pattern = jsonencode({ source = [ "aws.sms" @@ -1127,9 +1128,9 @@ resource "aws_cloudwatch_event_rule" "sms_failure_cloud_watch_event" { }) } -resource "aws_cloudwatch_event_target" "sms_failure_cloud_watch_event_target" { +resource "aws_cloudwatch_event_target" "sms_failure_cloudwatch_event_target" { count = var.enable_sms_failure_alerts ? 1 : 0 - rule = aws_cloudwatch_event_rule.sms_failure_cloud_watch_event[0].name + rule = aws_cloudwatch_event_rule.sms_failure_cloudwatch_event[0].name target_id = "FailurealertSNSTopicTarget" arn = aws_sns_topic.aws_alerts_sns_topic.id input_transformer { @@ -1156,10 +1157,10 @@ resource "aws_cloudwatch_event_target" "sms_failure_cloud_watch_event_target" { } } -resource "aws_cloudwatch_event_rule" "step_functions_failure_cloud_watch_event" { +resource "aws_cloudwatch_event_rule" "step_functions_failure_cloudwatch_event" { count = var.enable_step_functions_failure_alerts ? 1 : 0 - name = "step-functions-failure-cloudwatch-event" - description = "AWS CloudWatch Event to send alerts on AWS SNS regarding AWS Step Functions Failures." + name = "aws-alerts-step-functions-failure-cloudwatch-event" + description = "AWS CloudWatch event to send alerts on AWS SNS regarding AWS Step Functions failures." event_pattern = jsonencode({ source = [ "aws.states" @@ -1177,9 +1178,9 @@ resource "aws_cloudwatch_event_rule" "step_functions_failure_cloud_watch_event" }) } -resource "aws_cloudwatch_event_target" "step_functions_failure_cloud_watch_event_target" { +resource "aws_cloudwatch_event_target" "step_functions_failure_cloudwatch_event_target" { count = var.enable_step_functions_failure_alerts ? 1 : 0 - rule = aws_cloudwatch_event_rule.step_functions_failure_cloud_watch_event[0].name + rule = aws_cloudwatch_event_rule.step_functions_failure_cloudwatch_event[0].name target_id = "FailurealertSNSTopicTarget" arn = aws_sns_topic.aws_alerts_sns_topic.id input_transformer { @@ -1206,10 +1207,10 @@ resource "aws_cloudwatch_event_target" "step_functions_failure_cloud_watch_event } } -resource "aws_cloudwatch_event_rule" "ssm_maintainance_window_failure_cloud_watch_event" { +resource "aws_cloudwatch_event_rule" "ssm_maintainance_window_failure_cloudwatch_event" { count = var.enable_ssm_maintainance_window_failure_alerts ? 1 : 0 - name = "ssm-maintainance-window-failure-cloudwatch-event" - description = "AWS CloudWatch Event to send alerts on AWS SNS regarding AWS SSM Maintainance Window Failures." + name = "aws-alerts-ssm-maintainance-window-failure-cloudwatch-event" + description = "AWS CloudWatch event to send alerts on AWS SNS regarding AWS SSM Maintainance Window failures." event_pattern = jsonencode({ source = [ "aws.ssm" @@ -1229,9 +1230,9 @@ resource "aws_cloudwatch_event_rule" "ssm_maintainance_window_failure_cloud_watc }) } -resource "aws_cloudwatch_event_target" "ssm_maintainance_window_failure_cloud_watch_event_target" { +resource "aws_cloudwatch_event_target" "ssm_maintainance_window_failure_cloudwatch_event_target" { count = var.enable_ssm_maintainance_window_failure_alerts ? 1 : 0 - rule = aws_cloudwatch_event_rule.ssm_maintainance_window_failure_cloud_watch_event[0].name + rule = aws_cloudwatch_event_rule.ssm_maintainance_window_failure_cloudwatch_event[0].name target_id = "FailurealertSNSTopicTarget" arn = aws_sns_topic.aws_alerts_sns_topic.id input_transformer { @@ -1258,10 +1259,10 @@ resource "aws_cloudwatch_event_target" "ssm_maintainance_window_failure_cloud_wa } } -resource "aws_cloudwatch_event_rule" "ssmec2_failure_cloud_watch_event" { +resource "aws_cloudwatch_event_rule" "ssmec2_failure_cloudwatch_event" { count = var.enable_ssmec2_failure_alerts ? 1 : 0 - name = "ssm-ec2-failure-cloudwatch-event" - description = "AWS CloudWatch Event to send alerts on AWS SNS regarding AWS SSM EC2 State Manager, Run Command and Automation Failures." + name = "aws-alerts-ssm-ec2-failure-cloudwatch-event" + description = "AWS CloudWatch event to send alerts on AWS SNS regarding AWS SSM EC2 State Manager, Run Command and Automation failures." event_pattern = jsonencode({ source = [ "aws.ssm" @@ -1284,9 +1285,9 @@ resource "aws_cloudwatch_event_rule" "ssmec2_failure_cloud_watch_event" { }) } -resource "aws_cloudwatch_event_target" "ssmec2_failure_cloud_watch_event_target" { +resource "aws_cloudwatch_event_target" "ssmec2_failure_cloudwatch_event_target" { count = var.enable_ssmec2_failure_alerts ? 1 : 0 - rule = aws_cloudwatch_event_rule.ssmec2_failure_cloud_watch_event[0].name + rule = aws_cloudwatch_event_rule.ssmec2_failure_cloudwatch_event[0].name target_id = "FailurealertSNSTopicTarget" arn = aws_sns_topic.aws_alerts_sns_topic.id input_transformer { @@ -1313,10 +1314,10 @@ resource "aws_cloudwatch_event_target" "ssmec2_failure_cloud_watch_event_target" } } -resource "aws_cloudwatch_event_rule" "ssm_compliance_warning_cloud_watch_event" { +resource "aws_cloudwatch_event_rule" "ssm_compliance_warning_cloudwatch_event" { count = var.enable_ssm_compliance_warning_alerts ? 1 : 0 - name = "ssm-compliance-warning-cloudwatch-event" - description = "AWS CloudWatch Event to send alerts on AWS SNS regarding AWS SSM Compliance Warnings." + name = "aws-alerts-ssm-compliance-warning-cloudwatch-event" + description = "AWS CloudWatch event to send alerts on AWS SNS regarding AWS SSM Compliance Warnings." event_pattern = jsonencode({ source = [ "aws.ssm" @@ -1332,9 +1333,9 @@ resource "aws_cloudwatch_event_rule" "ssm_compliance_warning_cloud_watch_event" }) } -resource "aws_cloudwatch_event_target" "ssm_compliance_warning_cloud_watch_event_target" { +resource "aws_cloudwatch_event_target" "ssm_compliance_warning_cloudwatch_event_target" { count = var.enable_ssm_compliance_warning_alerts ? 1 : 0 - rule = aws_cloudwatch_event_rule.ssm_compliance_warning_cloud_watch_event[0].name + rule = aws_cloudwatch_event_rule.ssm_compliance_warning_cloudwatch_event[0].name target_id = "FailurealertSNSTopicTarget" arn = aws_sns_topic.aws_alerts_sns_topic.id input_transformer { @@ -1361,10 +1362,10 @@ resource "aws_cloudwatch_event_target" "ssm_compliance_warning_cloud_watch_event } } -resource "aws_cloudwatch_event_rule" "ops_works_failure_cloud_watch_event" { +resource "aws_cloudwatch_event_rule" "ops_works_failure_cloudwatch_event" { count = var.enable_ops_works_failure_alerts ? 1 : 0 - name = "opsworks-failure-cloudwatch-event" - description = "AWS CloudWatch Event to send alerts on AWS SNS regarding AWS OpsWorks Failures." + name = "aws-alerts-opsworks-failure-cloudwatch-event" + description = "AWS CloudWatch event to send alerts on AWS SNS regarding AWS OpsWorks failures." event_pattern = jsonencode({ source = [ "aws.opsworks" @@ -1391,9 +1392,9 @@ resource "aws_cloudwatch_event_rule" "ops_works_failure_cloud_watch_event" { }) } -resource "aws_cloudwatch_event_target" "ops_works_failure_cloud_watch_event_target" { +resource "aws_cloudwatch_event_target" "ops_works_failure_cloudwatch_event_target" { count = var.enable_ops_works_failure_alerts ? 1 : 0 - rule = aws_cloudwatch_event_rule.ops_works_failure_cloud_watch_event[0].name + rule = aws_cloudwatch_event_rule.ops_works_failure_cloudwatch_event[0].name target_id = "FailurealertSNSTopicTarget" arn = aws_sns_topic.aws_alerts_sns_topic.id input_transformer { @@ -1420,10 +1421,10 @@ resource "aws_cloudwatch_event_target" "ops_works_failure_cloud_watch_event_targ } } -resource "aws_cloudwatch_event_rule" "ops_works_error_cloud_watch_event" { +resource "aws_cloudwatch_event_rule" "ops_works_error_cloudwatch_event" { count = var.enable_ops_works_error_alerts ? 1 : 0 - name = "opsworks-error-cloudwatch-event" - description = "AWS CloudWatch Event to send alerts on AWS SNS regarding AWS OpsWorks Errors." + name = "aws-alerts-opsworks-error-cloudwatch-event" + description = "AWS CloudWatch event to send alerts on AWS SNS regarding AWS OpsWorks Errors." event_pattern = jsonencode({ source = [ "aws.opsworks" @@ -1434,9 +1435,9 @@ resource "aws_cloudwatch_event_rule" "ops_works_error_cloud_watch_event" { }) } -resource "aws_cloudwatch_event_target" "ops_works_error_cloud_watch_event_target" { +resource "aws_cloudwatch_event_target" "ops_works_error_cloudwatch_event_target" { count = var.enable_ops_works_error_alerts ? 1 : 0 - rule = aws_cloudwatch_event_rule.ops_works_error_cloud_watch_event[0].name + rule = aws_cloudwatch_event_rule.ops_works_error_cloudwatch_event[0].name target_id = "FailurealertSNSTopicTarget" arn = aws_sns_topic.aws_alerts_sns_topic.id input_transformer { @@ -1463,10 +1464,10 @@ resource "aws_cloudwatch_event_target" "ops_works_error_cloud_watch_event_target } } -resource "aws_cloudwatch_event_rule" "kms_key_expiration_warning_cloud_watch_event" { +resource "aws_cloudwatch_event_rule" "kms_key_expiration_warning_cloudwatch_event" { count = var.enable_kms_key_expiration_warning_alerts ? 1 : 0 - name = "kms-key-expiration-warning-cloudwatch-event" - description = "AWS CloudWatch Event to send alerts on AWS SNS regarding AWS KMS Key Expiration Warnings." + name = "aws-alerts-kms-key-expiration-warning-cloudwatch-event" + description = "AWS CloudWatch event to send alerts on AWS SNS regarding AWS KMS Key Expiration Warnings." event_pattern = jsonencode({ source = [ "aws.kms" @@ -1477,9 +1478,9 @@ resource "aws_cloudwatch_event_rule" "kms_key_expiration_warning_cloud_watch_eve }) } -resource "aws_cloudwatch_event_target" "kms_key_expiration_warning_cloud_watch_event_target" { +resource "aws_cloudwatch_event_target" "kms_key_expiration_warning_cloudwatch_event_target" { count = var.enable_kms_key_expiration_warning_alerts ? 1 : 0 - rule = aws_cloudwatch_event_rule.kms_key_expiration_warning_cloud_watch_event[0].name + rule = aws_cloudwatch_event_rule.kms_key_expiration_warning_cloudwatch_event[0].name target_id = "FailurealertSNSTopicTarget" arn = aws_sns_topic.aws_alerts_sns_topic.id input_transformer { @@ -1506,10 +1507,10 @@ resource "aws_cloudwatch_event_target" "kms_key_expiration_warning_cloud_watch_e } } -resource "aws_cloudwatch_event_rule" "macie_warning_cloud_watch_event" { +resource "aws_cloudwatch_event_rule" "macie_warning_cloudwatch_event" { count = var.enable_macie_warning_alerts ? 1 : 0 - name = "macie-warning-cloudwatch-event" - description = "AWS CloudWatch Event to send alerts on AWS SNS regarding AWS Macie Warnings." + name = "aws-alerts-macie-warning-cloudwatch-event" + description = "AWS CloudWatch event to send alerts on AWS SNS regarding AWS Macie Warnings." event_pattern = jsonencode({ source = [ "aws.macie" @@ -1520,9 +1521,9 @@ resource "aws_cloudwatch_event_rule" "macie_warning_cloud_watch_event" { }) } -resource "aws_cloudwatch_event_target" "macie_warning_cloud_watch_event_target" { +resource "aws_cloudwatch_event_target" "macie_warning_cloudwatch_event_target" { count = var.enable_macie_warning_alerts ? 1 : 0 - rule = aws_cloudwatch_event_rule.macie_warning_cloud_watch_event[0].name + rule = aws_cloudwatch_event_rule.macie_warning_cloudwatch_event[0].name target_id = "FailurealertSNSTopicTarget" arn = aws_sns_topic.aws_alerts_sns_topic.id input_transformer { @@ -1549,10 +1550,10 @@ resource "aws_cloudwatch_event_target" "macie_warning_cloud_watch_event_target" } } -resource "aws_cloudwatch_event_rule" "game_lift_failure_cloud_watch_event" { +resource "aws_cloudwatch_event_rule" "game_lift_failure_cloudwatch_event" { count = var.enable_game_lift_failure_alerts ? 1 : 0 - name = "gamelift-failure-cloudwatch-event" - description = "AWS CloudWatch Event to send alerts on AWS SNS regarding AWS GameLift Failures." + name = "aws-alerts-gamelift-failure-cloudwatch-event" + description = "AWS CloudWatch event to send alerts on AWS SNS regarding AWS GameLift failures." event_pattern = jsonencode({ source = [ "aws.gamelift" @@ -1570,9 +1571,9 @@ resource "aws_cloudwatch_event_rule" "game_lift_failure_cloud_watch_event" { }) } -resource "aws_cloudwatch_event_target" "game_lift_failure_cloud_watch_event_target" { +resource "aws_cloudwatch_event_target" "game_lift_failure_cloudwatch_event_target" { count = var.enable_game_lift_failure_alerts ? 1 : 0 - rule = aws_cloudwatch_event_rule.game_lift_failure_cloud_watch_event[0].name + rule = aws_cloudwatch_event_rule.game_lift_failure_cloudwatch_event[0].name target_id = "FailurealertSNSTopicTarget" arn = aws_sns_topic.aws_alerts_sns_topic.id input_transformer { @@ -1599,10 +1600,10 @@ resource "aws_cloudwatch_event_target" "game_lift_failure_cloud_watch_event_targ } } -resource "aws_cloudwatch_event_rule" "transcribe_failure_cloud_watch_event" { +resource "aws_cloudwatch_event_rule" "transcribe_failure_cloudwatch_event" { count = var.enable_transcribe_failure_alerts ? 1 : 0 - name = "transcribe-failure-cloudwatch-event" - description = "AWS CloudWatch Event to send alerts on AWS SNS regarding AWS Transcribe Failures." + name = "aws-alerts-transcribe-failure-cloudwatch-event" + description = "AWS CloudWatch event to send alerts on AWS SNS regarding AWS Transcribe failures." event_pattern = jsonencode({ source = [ "aws.transcribe" @@ -1618,9 +1619,9 @@ resource "aws_cloudwatch_event_rule" "transcribe_failure_cloud_watch_event" { }) } -resource "aws_cloudwatch_event_target" "transcribe_failure_cloud_watch_event_target" { +resource "aws_cloudwatch_event_target" "transcribe_failure_cloudwatch_event_target" { count = var.enable_transcribe_failure_alerts ? 1 : 0 - rule = aws_cloudwatch_event_rule.transcribe_failure_cloud_watch_event[0].name + rule = aws_cloudwatch_event_rule.transcribe_failure_cloudwatch_event[0].name target_id = "FailurealertSNSTopicTarget" arn = aws_sns_topic.aws_alerts_sns_topic.id input_transformer { @@ -1647,10 +1648,10 @@ resource "aws_cloudwatch_event_target" "transcribe_failure_cloud_watch_event_tar } } -resource "aws_cloudwatch_event_rule" "signer_failure_cloud_watch_event" { +resource "aws_cloudwatch_event_rule" "signer_failure_cloudwatch_event" { count = var.enable_signer_failure_alerts ? 1 : 0 - name = "signer-failure-cloudwatch-event" - description = "AWS CloudWatch Event to send alerts on AWS SNS regarding AWS Signer Failures." + name = "aws-alerts-signer-failure-cloudwatch-event" + description = "AWS CloudWatch event to send alerts on AWS SNS regarding AWS Signer failures." event_pattern = jsonencode({ source = [ "aws.signer" @@ -1666,9 +1667,9 @@ resource "aws_cloudwatch_event_rule" "signer_failure_cloud_watch_event" { }) } -resource "aws_cloudwatch_event_target" "signer_failure_cloud_watch_event_target" { +resource "aws_cloudwatch_event_target" "signer_failure_cloudwatch_event_target" { count = var.enable_signer_failure_alerts ? 1 : 0 - rule = aws_cloudwatch_event_rule.signer_failure_cloud_watch_event[0].name + rule = aws_cloudwatch_event_rule.signer_failure_cloudwatch_event[0].name target_id = "FailurealertSNSTopicTarget" arn = aws_sns_topic.aws_alerts_sns_topic.id input_transformer { @@ -1695,10 +1696,10 @@ resource "aws_cloudwatch_event_target" "signer_failure_cloud_watch_event_target" } } -resource "aws_cloudwatch_event_rule" "data_sync_error_warning_cloud_watch_event" { +resource "aws_cloudwatch_event_rule" "data_sync_error_warning_cloudwatch_event" { count = var.enable_data_sync_error_warning_alerts ? 1 : 0 - name = "datasync-error-warning-cloudwatch-event" - description = "AWS CloudWatch Event to send alerts on AWS SNS regarding AWS DataSync Errors and Warnings." + name = "aws-alerts-datasync-error-warning-cloudwatch-event" + description = "AWS CloudWatch event to send alerts on AWS SNS regarding AWS DataSync Errors and Warnings." event_pattern = jsonencode({ source = [ "aws.datasync" @@ -1718,9 +1719,9 @@ resource "aws_cloudwatch_event_rule" "data_sync_error_warning_cloud_watch_event" }) } -resource "aws_cloudwatch_event_target" "data_sync_error_warning_cloud_watch_event_target" { +resource "aws_cloudwatch_event_target" "data_sync_error_warning_cloudwatch_event_target" { count = var.enable_data_sync_error_warning_alerts ? 1 : 0 - rule = aws_cloudwatch_event_rule.data_sync_error_warning_cloud_watch_event[0].name + rule = aws_cloudwatch_event_rule.data_sync_error_warning_cloudwatch_event[0].name target_id = "FailurealertSNSTopicTarget" arn = aws_sns_topic.aws_alerts_sns_topic.id input_transformer { @@ -1747,10 +1748,10 @@ resource "aws_cloudwatch_event_target" "data_sync_error_warning_cloud_watch_even } } -resource "aws_cloudwatch_event_rule" "iot_analytics_failure_cloud_watch_event" { +resource "aws_cloudwatch_event_rule" "iot_analytics_failure_cloudwatch_event" { count = var.enable_iot_analytics_failure_alerts ? 1 : 0 - name = "iot-analytics-failure-cloudwatch-event" - description = "AWS CloudWatch Event to send alerts on AWS SNS regarding AWS IoT Analytics Failures." + name = "aws-alerts-iot-analytics-failure-cloudwatch-event" + description = "AWS CloudWatch event to send alerts on AWS SNS regarding AWS IoT Analytics failures." event_pattern = jsonencode({ source = [ "aws.iotanalytics" @@ -1766,9 +1767,9 @@ resource "aws_cloudwatch_event_rule" "iot_analytics_failure_cloud_watch_event" { }) } -resource "aws_cloudwatch_event_target" "iot_analytics_failure_cloud_watch_event_target" { +resource "aws_cloudwatch_event_target" "iot_analytics_failure_cloudwatch_event_target" { count = var.enable_iot_analytics_failure_alerts ? 1 : 0 - rule = aws_cloudwatch_event_rule.iot_analytics_failure_cloud_watch_event[0].name + rule = aws_cloudwatch_event_rule.iot_analytics_failure_cloudwatch_event[0].name target_id = "FailurealertSNSTopicTarget" arn = aws_sns_topic.aws_alerts_sns_topic.id input_transformer { @@ -1795,10 +1796,10 @@ resource "aws_cloudwatch_event_target" "iot_analytics_failure_cloud_watch_event_ } } -resource "aws_cloudwatch_event_rule" "data_lifecycle_manager_error_cloud_watch_event" { +resource "aws_cloudwatch_event_rule" "data_lifecycle_manager_error_cloudwatch_event" { count = var.enable_data_lifecycle_manager_error_alerts ? 1 : 0 - name = "data-lifecycle-manager-error-cloudwatch-event" - description = "AWS CloudWatch Event to send alerts on AWS SNS regarding AWS Data Lifecycle Manager Errors." + name = "aws-alerts-data-lifecycle-manager-error-cloudwatch-event" + description = "AWS CloudWatch event to send alerts on AWS SNS regarding AWS Data Lifecycle Manager Errors." event_pattern = jsonencode({ source = [ "aws.dlm" @@ -1814,9 +1815,9 @@ resource "aws_cloudwatch_event_rule" "data_lifecycle_manager_error_cloud_watch_e }) } -resource "aws_cloudwatch_event_target" "data_lifecycle_manager_error_cloud_watch_event_target" { +resource "aws_cloudwatch_event_target" "data_lifecycle_manager_error_cloudwatch_event_target" { count = var.enable_data_lifecycle_manager_error_alerts ? 1 : 0 - rule = aws_cloudwatch_event_rule.data_lifecycle_manager_error_cloud_watch_event[0].name + rule = aws_cloudwatch_event_rule.data_lifecycle_manager_error_cloudwatch_event[0].name target_id = "FailurealertSNSTopicTarget" arn = aws_sns_topic.aws_alerts_sns_topic.id input_transformer { @@ -1843,10 +1844,10 @@ resource "aws_cloudwatch_event_target" "data_lifecycle_manager_error_cloud_watch } } -resource "aws_cloudwatch_event_rule" "elemental_media_package_error_cloud_watch_event" { +resource "aws_cloudwatch_event_rule" "elemental_media_package_error_cloudwatch_event" { count = var.enable_elemental_media_package_error_alerts ? 1 : 0 - name = "elemental-mediapackage-error-cloudwatch-event" - description = "AWS CloudWatch Event to send alerts on AWS SNS regarding AWS Elemental MediaPackage Errors." + name = "aws-alerts-elemental-mediapackage-error-cloudwatch-event" + description = "AWS CloudWatch event to send alerts on AWS SNS regarding AWS Elemental MediaPackage Errors." event_pattern = jsonencode({ source = [ "aws.mediapackage" @@ -1865,9 +1866,9 @@ resource "aws_cloudwatch_event_rule" "elemental_media_package_error_cloud_watch_ }) } -resource "aws_cloudwatch_event_target" "elemental_media_package_error_cloud_watch_event_target" { +resource "aws_cloudwatch_event_target" "elemental_media_package_error_cloudwatch_event_target" { count = var.enable_elemental_media_package_error_alerts ? 1 : 0 - rule = aws_cloudwatch_event_rule.elemental_media_package_error_cloud_watch_event[0].name + rule = aws_cloudwatch_event_rule.elemental_media_package_error_cloudwatch_event[0].name target_id = "FailurealertSNSTopicTarget" arn = aws_sns_topic.aws_alerts_sns_topic.id input_transformer { @@ -1894,10 +1895,10 @@ resource "aws_cloudwatch_event_target" "elemental_media_package_error_cloud_watc } } -resource "aws_cloudwatch_event_rule" "elemental_media_live_error_cloud_watch_event" { +resource "aws_cloudwatch_event_rule" "elemental_media_live_error_cloudwatch_event" { count = var.enable_elemental_media_live_error_alerts ? 1 : 0 - name = "elemental-medialive-error-cloudwatch-event" - description = "AWS CloudWatch Event to send alerts on AWS SNS regarding AWS Elemental MediaLive Errors." + name = "aws-alerts-elemental-medialive-error-cloudwatch-event" + description = "AWS CloudWatch event to send alerts on AWS SNS regarding AWS Elemental MediaLive Errors." event_pattern = jsonencode({ source = [ "aws.medialive" @@ -1908,9 +1909,9 @@ resource "aws_cloudwatch_event_rule" "elemental_media_live_error_cloud_watch_eve }) } -resource "aws_cloudwatch_event_target" "elemental_media_live_error_cloud_watch_event_target" { +resource "aws_cloudwatch_event_target" "elemental_media_live_error_cloudwatch_event_target" { count = var.enable_elemental_media_live_error_alerts ? 1 : 0 - rule = aws_cloudwatch_event_rule.elemental_media_live_error_cloud_watch_event[0].name + rule = aws_cloudwatch_event_rule.elemental_media_live_error_cloudwatch_event[0].name target_id = "FailurealertSNSTopicTarget" arn = aws_sns_topic.aws_alerts_sns_topic.id input_transformer { @@ -1937,10 +1938,10 @@ resource "aws_cloudwatch_event_target" "elemental_media_live_error_cloud_watch_e } } -resource "aws_cloudwatch_event_rule" "elemental_media_convert_error_cloud_watch_event" { +resource "aws_cloudwatch_event_rule" "elemental_media_convert_error_cloudwatch_event" { count = var.enable_elemental_media_convert_error_alerts ? 1 : 0 - name = "elemental-mediaconvert-error-cloudwatch-event" - description = "AWS CloudWatch Event to send alerts on AWS SNS regarding AWS Elemental MediaConvert Errors." + name = "aws-alerts-elemental-mediaconvert-error-cloudwatch-event" + description = "AWS CloudWatch event to send alerts on AWS SNS regarding AWS Elemental MediaConvert Errors." event_pattern = jsonencode({ source = [ "aws.mediaconvert" @@ -1956,9 +1957,9 @@ resource "aws_cloudwatch_event_rule" "elemental_media_convert_error_cloud_watch_ }) } -resource "aws_cloudwatch_event_target" "elemental_media_convert_error_cloud_watch_event_target" { +resource "aws_cloudwatch_event_target" "elemental_media_convert_error_cloudwatch_event_target" { count = var.enable_elemental_media_convert_error_alerts ? 1 : 0 - rule = aws_cloudwatch_event_rule.elemental_media_convert_error_cloud_watch_event[0].name + rule = aws_cloudwatch_event_rule.elemental_media_convert_error_cloudwatch_event[0].name target_id = "FailurealertSNSTopicTarget" arn = aws_sns_topic.aws_alerts_sns_topic.id input_transformer { @@ -1985,10 +1986,10 @@ resource "aws_cloudwatch_event_target" "elemental_media_convert_error_cloud_watc } } -resource "aws_cloudwatch_event_rule" "sage_maker_hyper_parameter_tuning_failure_cloud_watch_event" { - count = var.enable_sage_maker_hyper_parameter_tuning_failure_alerts ? 1 : 0 - name = "sagemaker-hyperparameter-tuning-failure-cloudwatch-event" - description = "AWS CloudWatch Event to send alerts on AWS SNS regarding AWS SageMaker HyperParameter Tuning Failures." +resource "aws_cloudwatch_event_rule" "sagemaker_hyperparameter_failure_cloudwatch_event" { + count = var.enable_sagemaker_hyperparameter_failure_alerts ? 1 : 0 + name = "aws-alerts-sagemaker-hyperparameter-failure-cloudwatch-event" + description = "AWS CloudWatch event to send alerts on AWS SNS regarding AWS SageMaker HyperParameter Tuning Job failures." event_pattern = jsonencode({ source = [ "aws.sagemaker" @@ -2004,9 +2005,9 @@ resource "aws_cloudwatch_event_rule" "sage_maker_hyper_parameter_tuning_failure_ }) } -resource "aws_cloudwatch_event_target" "sage_maker_hyper_parameter_tuning_failure_cloud_watch_event_target" { - count = var.enable_sage_maker_hyper_parameter_tuning_failure_alerts ? 1 : 0 - rule = aws_cloudwatch_event_rule.sage_maker_hyper_parameter_tuning_failure_cloud_watch_event[0].name +resource "aws_cloudwatch_event_target" "sagemaker_hyperparameter_failure_cloudwatch_event_target" { + count = var.enable_sagemaker_hyperparameter_failure_alerts ? 1 : 0 + rule = aws_cloudwatch_event_rule.sagemaker_hyperparameter_failure_cloudwatch_event[0].name target_id = "FailurealertSNSTopicTarget" arn = aws_sns_topic.aws_alerts_sns_topic.id input_transformer { @@ -2033,10 +2034,10 @@ resource "aws_cloudwatch_event_target" "sage_maker_hyper_parameter_tuning_failur } } -resource "aws_cloudwatch_event_rule" "sage_maker_transform_failure_cloud_watch_event" { - count = var.enable_sage_maker_transform_failure_alerts ? 1 : 0 - name = "sagemaker-transform-failure-cloudwatch-event" - description = "AWS CloudWatch Event to send alerts on AWS SNS regarding AWS SageMaker Transform Failures." +resource "aws_cloudwatch_event_rule" "sagemaker_transform_failure_cloudwatch_event" { + count = var.enable_sagemaker_transform_failure_alerts ? 1 : 0 + name = "aws-alerts-sagemaker-transform-failure-cloudwatch-event" + description = "AWS CloudWatch event to send alerts on AWS SNS regarding AWS SageMaker Transform Job failures." event_pattern = jsonencode({ source = [ "aws.sagemaker" @@ -2052,9 +2053,9 @@ resource "aws_cloudwatch_event_rule" "sage_maker_transform_failure_cloud_watch_e }) } -resource "aws_cloudwatch_event_target" "sage_maker_transform_failure_cloud_watch_event_target" { - count = var.enable_sage_maker_transform_failure_alerts ? 1 : 0 - rule = aws_cloudwatch_event_rule.sage_maker_transform_failure_cloud_watch_event[0].name +resource "aws_cloudwatch_event_target" "sagemaker_transform_failure_cloudwatch_event_target" { + count = var.enable_sagemaker_transform_failure_alerts ? 1 : 0 + rule = aws_cloudwatch_event_rule.sagemaker_transform_failure_cloudwatch_event[0].name target_id = "FailurealertSNSTopicTarget" arn = aws_sns_topic.aws_alerts_sns_topic.id input_transformer { @@ -2081,10 +2082,10 @@ resource "aws_cloudwatch_event_target" "sage_maker_transform_failure_cloud_watch } } -resource "aws_cloudwatch_event_rule" "sage_maker_training_failure_cloud_watch_event" { - count = var.enable_sage_maker_training_failure_alerts ? 1 : 0 - name = "sagemaker-training-failure-cloudwatch-event" - description = "AWS CloudWatch Event to send alerts on AWS SNS regarding AWS SageMaker Training Failures." +resource "aws_cloudwatch_event_rule" "sagemaker_training_failure_cloudwatch_event" { + count = var.enable_sagemaker_training_failure_alerts ? 1 : 0 + name = "aws-alerts-sagemaker-training-failure-cloudwatch-event" + description = "AWS CloudWatch event to send alerts on AWS SNS regarding AWS SageMaker Training Job failures." event_pattern = jsonencode({ source = [ "aws.sagemaker" @@ -2100,9 +2101,9 @@ resource "aws_cloudwatch_event_rule" "sage_maker_training_failure_cloud_watch_ev }) } -resource "aws_cloudwatch_event_target" "sage_maker_training_failure_cloud_watch_event_target" { - count = var.enable_sage_maker_training_failure_alerts ? 1 : 0 - rule = aws_cloudwatch_event_rule.sage_maker_training_failure_cloud_watch_event[0].name +resource "aws_cloudwatch_event_target" "sagemaker_training_failure_cloudwatch_event_target" { + count = var.enable_sagemaker_training_failure_alerts ? 1 : 0 + rule = aws_cloudwatch_event_rule.sagemaker_training_failure_cloudwatch_event[0].name target_id = "FailurealertSNSTopicTarget" arn = aws_sns_topic.aws_alerts_sns_topic.id input_transformer { diff --git a/terraform/variables.tf b/terraform/variables.tf index 01c8359..faa3c36 100644 --- a/terraform/variables.tf +++ b/terraform/variables.tf @@ -237,19 +237,19 @@ variable "enable_elemental_media_convert_error_alerts" { default = false } -variable "enable_sage_maker_hyper_parameter_tuning_failure_alerts" { +variable "enable_sagemaker_hyperparameter_failure_alerts" { description = "Option to Enable AWS SageMaker HyperParameter Tuning Failure Notification." type = string default = false } -variable "enable_sage_maker_transform_failure_alerts" { +variable "enable_sagemaker_transform_failure_alerts" { description = "Option to Enable AWS SageMaker Transform Failure Notification." type = string default = false } -variable "enable_sage_maker_training_failure_alerts" { +variable "enable_sagemaker_training_failure_alerts" { description = "Option to Enable AWS SageMaker Training Failure Notification." type = string default = false