terraform.aws-baseline-infra/modules/ManagementGovernance/Monitoring.EKS/README.md
2022-12-30 00:01:39 +08:00

1.3 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. Unlike other monitoring modules which discovers resources details automatically, EKS pod name need to be supplied to this module. AWS cli does not provide pod information.

Example

data "aws_eks_clusters" "eks-clusters" {}

module "eks-monitoring" {
  cw-alarm-prefix                            = local.cw-alarm-prefix
  for_each                                   = data.aws_eks_clusters.eks-clusters.names
  source                                     = "../../modules/ManagementGovernance/Monitoring.EKS"
  default-tags                               = local.default-tags
  cluster-name                               = each.value
  eks-namespace                              = "default"
  pod-names                                  = ["depl-nginx", "depl-alpine"]
  threshold-pod_cpu_utilization              = 85
  threshold-pod_memory_utilization           = 85
  threshold-pod_number_of_container_restarts = 5
  actions-enabled                            = var.actions-enabled
  sns-targets                                = local.sns-targets
}