Configure metric alarms with multiple dimensions
masteralarm_name and the dimension keys.repository·master·Indexed 41 days ago
https://github.com/terraform-aws-modules/terraform-aws-cloudwatchA comprehensive Terraform module for managing AWS CloudWatch resources, including Log Groups, Metric Alarms, Metric Streams, Composite Alarms, and Data Protection Policies. It provides automated configurations for CIS AWS Foundations Controls, log anomaly detection, and streaming metrics to Kinesis Firehose and S3.
alarm_name and the dimension keys.This module allows you to manage AWS CloudWatch Log Data Protection Policies. These policies help identify and mask sensitive data (such as PII) within your CloudWatch Logs.
It can manage both the policy document (via a data source) and the actual policy resource attached to a log group. You can configure destinations for findings, such as S3, Kinesis Firehose, or another CloudWatch Log Group.
wrappers/composite-alarm directory provides a module wrapper implementation of the single module wrapper pattern. This pattern is designed for scenarios where using native Terraform for_each is not feasible, such as when using Terragrunt. It allows you to manage multiple instances of a composite alarm within a single configuration file without duplicating files for every resource.log-account-policy wrapper is a pattern used to manage multiple instances of the modules/log-account-policy module within a single configuration block. This is particularly useful in environments like Terragrunt where native Terraform for_each logic might not be feasible for managing multiple resource copies, allowing you to manage several resources without duplicating configuration files.The wrappers/log-stream directory provides a module wrapper pattern designed for scenarios where native Terraform for_each is not feasible, such as when using Terragrunt. This wrapper allows you to manage multiple instances of the modules/log-stream module within a single configuration block by defining a map of items.
This wrapper does not add new functionality; it simply facilitates bulk management of the underlying log-stream module resources using two primary input blocks:
defaults: A map of arguments applied to every item in the items block.items: A map where each key represents a unique instance, and the value is a map of arguments specific to that instance (which can override or supplement defaults).# Conceptual structure
inputs = {
defaults = {
# Shared arguments for all log streams
}
items = {
instance_one = {
# Specific arguments for instance_one
}
instance_two = {
# Specific arguments for instance_two
}
}
}The wrappers/metric-stream directory provides a module wrapper pattern designed for scenarios where native Terraform for_each is not feasible, such as when using Terragrunt. This wrapper allows you to manage multiple instances of the modules/metric-stream module within a single configuration file by defining a map of items and a set of default values.
This wrapper does not add new functionality; it only provides a mechanism to iterate over multiple configurations using a defaults block and an items block.
# Conceptual structure
inputs = {
defaults = {
# Common arguments for all items
}
items = {
item_one = {
# Specific arguments for item_one
}
item_two = {
# Specific arguments for item_two
}
}
}The wrappers/metric-alarm module implements a single module wrapper pattern. This allows you to manage multiple instances of the modules/metric-alarm module within a single configuration block. This is particularly useful in environments like Terragrunt where native Terraform for_each might not be feasible, or when you want to manage multiple resources without duplicating configuration files.
The wrapper accepts two primary configuration blocks:
defaults: A map of arguments applied to every item in the items collection.items: A map where each key represents a unique instance of the module, and the value is a map of arguments specific to that instance. Any argument supported by the underlying modules/metric-alarm module can be used here.The anomaly_visibility_time setting determines how long an anomaly remains flagged before being treated as normal behavior.
If an anomaly is not corrected within the specified time period (between 7 and 90 days), the detector will automatically baseline it. Once baselined, new occurrences of that same pattern will be treated as normal and will no longer trigger anomaly detections. It is critical to resolve the underlying cause of an anomaly before this period elapses.
This wrapper implements a single module wrapper pattern designed for scenarios where native Terraform for_each is not feasible, such as when using Terragrunt. It allows you to manage multiple instances of the metric-alarms-by-multiple-dimensions module within a single configuration block or Terragrunt file, preventing the need to duplicate terragrunt.hcl files for every individual resource.
Note that this wrapper does not add any new functionality; it simply provides a way to pass a map of items to the underlying module to facilitate bulk management.
The wrappers/log-group directory provides a pattern for managing multiple instances of the modules/log-group module within a single configuration block. This is particularly useful in environments like Terragrunt where native Terraform for_each logic might not be feasible for managing multiple distinct resource copies without duplicating configuration files.
This wrapper does not add new functionality; it simply maps a map of items to individual module calls. It uses two primary input blocks:
defaults: A map of arguments applied to every item in the items block.items: A map where each key represents a unique instance of a log group, and the value is a map of arguments specific to that instance. Arguments in items can override or supplement those in defaults (depending on the underlying module implementation).module "wrapper" {
source = "terraform-aws-modules/cloudwatch/aws//wrappers/log-group"
defaults = {
create = true
tags = {
Terraform = "true"
Environment = "dev"
}
}
items = {
my-item = {
# arguments for the first log group
}
my-second-item = {
# arguments for the second log group
}
}
}The log-anomaly-detector wrapper is a pattern used to manage multiple instances of the modules/log-anomaly-detector module within a single configuration block. This is particularly useful in environments like Terragrunt where native Terraform for_each might not be feasible, allowing you to manage several resources without duplicating configuration files.
The wrapper accepts two primary input maps:
defaults: A map of configuration arguments applied to every instance created.items: A map where each key represents a unique instance, and the value is a map of arguments specific to that instance. These arguments can be any valid argument supported by the underlying modules/log-anomaly-detector module.# Conceptual structure
inputs = {
defaults = {
create = true
tags = { Environment = "dev" }
}
items = {
instance_one = {
# specific arguments for instance_one
}
instance_two = {
# specific arguments for instance_two
}
}
}