terraform.aws-baseline-infra/modules/ManagementGovernance/Monitoring.EC2/README.md

1.0 KiB

Monitoring module

This module deploys the default cloudwatch metric monitoring

Notes

Terraform lifecycle ignores tags to speed up terraform subsequent update. Cloudwatch alarm tags cannot be read on aws console anyway.

Example

module "ec2-instances" {
  source        = "../../modules/util/resource-list"
  resource-type = "ec2"
}

module "ec2-monitoring" {
  cw-alarm-prefix            = local.cw-alarm-prefix
  for_each                   = module.ec2-instances.result-set
  source                     = "../../modules/ManagementGovernance/Monitoring.EC2"
  default-tags               = local.default-tags
  ec2-instance-id            = each.value
  threshold-CPUUtilization   = 90
  threshold-mem_free         = 100000
  threshold-swap_free        = 100000
  threshold-disk_free        = 1 * 1000 * 1000 * 1000
  threshold-disk_inodes_free = 10000
  threshold-processes_total  = 500
  threshold-LogicalDiskFreePct = 10
  threshold-MemoryCommittedPct = 90
  actions-enabled            = var.actions-enabled
  sns-targets = var.sns-targets
}