Use this module
module "prometheus" {
source = "registry.compliance.tf/terraform-aws-modules/managed-service-prometheus/aws"
workspace_alias = "example"
create_alert_manager = true
alert_manager_definition = <<-EOT
alertmanager_config: |
route:
receiver: 'default'
receivers:
- name: 'default'
EOT
rule_group_namespaces = {
first = {
name = "rule-01"
data = <<-EOT
groups:
- name: test
rules:
- record: metric:recording_rule
expr: avg(rate(container_cpu_usage_seconds_total[5m]))
EOT
}
second = {
name = "rule-02"
data = <<-EOT
groups:
- name: test
rules:
- record: metric:recording_rule
expr: avg(rate(container_cpu_usage_seconds_total[5m]))
EOT
}
}
}The example from the module's README, with this page's source.
Key inputs
Required inputs first, then the inputs the README example sets.
- workspace_aliasstring, default null
The alias of the prometheus workspace. See more in the [AWS Docs](https://docs.aws.amazon.com/prometheus/latest/userguide/AMP-onboard-create-workspace.html)
- create_alert_managerbool, default true
Controls whether an Alert Manager definition is created along with the AMP workspace
- alert_manager_definitionstring, default "alertmanager_config: | route: receiver: 'default' receivers: - name: 'default' "
The alert manager definition that you want to be applied. See more in the [AWS Docs](https://docs.aws.amazon.com/prometheus/latest/userguide/AMP-alert-manager.html)
- rule_group_namespacesmap({...}), default null
A map of one or more rule group namespace definitions