Skip to content

Commit

Permalink
Make custom_metrics.metric_stat optional (#19)
Browse files Browse the repository at this point in the history
we want to be able to omit the metric_stat object, for examples like calculation metrics
  • Loading branch information
faergestad authored Jun 24, 2024
1 parent ddf7365 commit bb578b8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
24 changes: 14 additions & 10 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -611,20 +611,24 @@ resource "aws_appautoscaling_policy" "ecs_service" {
content {
label = metrics.value.label
id = metrics.value.id
metric_stat {
metric {
metric_name = metrics.value.metric_stat.metric.metric_name
namespace = metrics.value.metric_stat.metric.namespace
dynamic "dimensions" {
for_each = metrics.value.metric_stat.metric.dimensions
content {
name = dimensions.value.name
value = dimensions.value.value
dynamic metric_stat {
for_each = metrics.value.metric_stat[*]
content {
metric {
metric_name = metric_stat.value.metric.metric_name
namespace = metric_stat.value.metric.namespace
dynamic "dimensions" {
for_each = metric_stat.value.metric.dimensions
content {
name = dimensions.value.name
value = dimensions.value.value
}
}
}
stat = metric_stat.value.stat
}
stat = metrics.value.metric_stat.stat
}
expression = metrics.value.expression
return_data = metrics.value.return_data
}
}
Expand Down
5 changes: 3 additions & 2 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,8 @@ variable "custom_metrics" {
type = list(object({
label = string
id = string
metric_stat = object({
expression = optional(string)
metric_stat = optional(object({
metric = object({
metric_name = string
namespace = string
Expand All @@ -249,7 +250,7 @@ variable "custom_metrics" {
}))
})
stat = string
})
}))
return_data = bool
}))
default = []
Expand Down

0 comments on commit bb578b8

Please sign in to comment.