Skip to content

Monitors the status of all MSK cluster in an AWS account and sends out notifications when a cluster is not in the ACTIVE state.

License

Notifications You must be signed in to change notification settings

stefanfreitag/terraform-aws-msk-status-monitor

Repository files navigation

terraform-aws-msk-health

Terraform Version License

This module deploys a Lambda function that checks the health of MSK cluster and sends a notification if a cluster is unhealthy.

If the target for ok_actions, alarm_actions or insufficient_data_actions is an SNS topic using a KMS key, ensure that CloudWatch Alarms has sufficient permissions to publish messages. For example:

statement {
    sid    = "Allow access for CloudWatch Alarms"
    effect = "Allow"
    principals {
      type        = "Service"
      identifiers = ["cloudwatch.amazonaws.com"]
    }
    actions = [
      "kms:Decrypt",
      "kms:GenerateDataKey"
    ]
    resources = ["*"]

  }

Requirements

Name Version
terraform >= 1.0
archive >=2.4.0
aws >= 5.32
random >=3.5.1

Providers

Name Version
archive >=2.4.0
aws >= 5.32

Modules

No modules.

Resources

Name Type
aws_cloudwatch_event_rule.this resource
aws_cloudwatch_event_target.this resource
aws_cloudwatch_log_group.this resource
aws_cloudwatch_metric_alarm.this resource
aws_iam_policy.this resource
aws_iam_role.this resource
aws_iam_role_policy_attachment.this resource
aws_lambda_function.this resource
aws_lambda_permission.this resource
aws_sns_topic.this resource
aws_sns_topic_subscription.this resource
archive_file.status_checker_code data source
aws_caller_identity.current data source
aws_region.current data source

Inputs

Name Description Type Default Required
alarm_actions The list of actions to execute when this alarm transitions into an ALARM state from any other state. Each action is specified as an Amazon Resource Name (ARN). Default is null. list(string) null no
cloudwatch_alarms_treat_missing_data Sets how the alarms handle missing data points. The following values are supported: missing, ignore, breaching and notBreaching. Default is breaching. string "breaching" no
cluster_arns List of MSK cluster ARNs. Default is []. list(string) [] no
email List of e-mail addresses subscribing to the SNS topic. Default is []. list(string) [] no
enable_cloudwatch_alarms Setup CloudWatch alarms for the MSK clusters state. For each state a separate alarm will be created. Default is false. bool false no
enable_sns_notifications Setup SNS notifications for the MSK clusters state. Default is false. bool false no
ignore_states Suppress warnings for the listed MSK states. Default: ['MAINTENANCE'] list(string)
[
"MAINTENANCE"
]
no
insufficient_data_actions The list of actions to execute when this alarm transitions into an INSUFFICIENT_DATA state from any other state. Each action is specified as an Amazon Resource Name (ARN). Default is null. list(string) null no
log_retion_period_in_days Number of days logs will be retained. Default is 365. number 365 no
memory_size Amount of memory in MByte that the Lambda function can use at runtime. Default is 160. number 160 no
name Name of the health monitor. Default is msk_status_monitor. string "msk_status_monitor" no
ok_actions The list of actions to execute when this alarm transitions into an OK state from any other state. Each action is specified as an Amazon Resource Name (ARN). list(string) null no
schedule_expression The schedule expression for the CloudWatch event rule. Default is rate(5 minutes). string "rate(5 minutes)" no
tags A map of tags to add to all resources. Default is {}. map(string) {} no

Outputs

Name Description
cloudwatch_metric_alarm_arns A map consisting of MSK cluster names and their CloudWatch metric alarm ARNs.
role_arn The ARN of the IAM role.
sns_topic_arn The ARN of the SNS topic.

About

Monitors the status of all MSK cluster in an AWS account and sends out notifications when a cluster is not in the ACTIVE state.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •