-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrusted_advisor.tf
38 lines (38 loc) · 1.46 KB
/
trusted_advisor.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
locals {
regional_metrics = yamldecode(data.local_file.metrics.content)["dashboard_data"]["trusted_advisor_regional"]
filtered_regional_metrics = flatten([
for service_name, id in local.regional_metrics : [
for region in var.regions : [
{
type = "metric"
properties = {
region = "us-east-1"
period = 300
view = "timeSeries"
title = format("%s: %s", service_name, region)
yAxis = {
left = {
label = "Quota usage percentage"
min = 0
max = 100
showUnits = false
}
}
metrics = concat([
for id, metric_config in id : flatten([
[
"AWS/TrustedAdvisor", metric_config["metric_name"], "ServiceName", metric_config["dimensions"]["ServiceName"], "ServiceLimit", metric_config["dimensions"]["ServiceLimit"], "Region", region,
{ id = metric_config["dashboard_query_id"], visible = false, stat = metric_config["statistic"] }
]
])
],
[for id, metric_config in id : [
{ expression = "${metric_config["dashboard_query_id"]}*100", label = format("%s: %s", service_name, metric_config["dimensions"]["ServiceLimit"]) }
]]
)
}
}
]
] if !contains(var.disabled_services, service_name)
])
}