Skip to content

Commit

Permalink
Merge pull request #19668 from hashicorp/b-aws_cloudwatch_metric_alar…
Browse files Browse the repository at this point in the history
…m-stat-regression

r/aws_cloudwatch_metric_alarm: Allow extended statistics in `metric.stat` argument
  • Loading branch information
ewbankkit authored Jun 8, 2021
2 parents 69611c1 + d1ce0c7 commit 5fdecce
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .changelog/19668.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
resource/aws_cloudwatch_metric_alarm: Allow extended statistics in the `stat` argument of the `metric` configuration block
```
9 changes: 6 additions & 3 deletions aws/resource_aws_cloudwatch_metric_alarm.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,12 @@ func resourceAwsCloudWatchMetricAlarm() *schema.Resource {
Required: true,
},
"stat": {
Type: schema.TypeString,
Required: true,
ValidateFunc: validation.StringInSlice(cloudwatch.Statistic_Values(), false),
Type: schema.TypeString,
Required: true,
ValidateFunc: validation.Any(
validation.StringInSlice(cloudwatch.Statistic_Values(), false),
validation.StringMatch(regexp.MustCompile(`p(\d{1,2}(\.\d{0,2})?|100)`), "must specify a value between p0.0 and p100"),
),
},
"unit": {
Type: schema.TypeString,
Expand Down
2 changes: 1 addition & 1 deletion aws/resource_aws_cloudwatch_metric_alarm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,7 @@ resource "aws_cloudwatch_metric_alarm" "test" {
metric_name = "CPUUtilization"
namespace = "AWS/EC2"
period = "120"
stat = "Average"
stat = "p95.45"
unit = "Count"
dimensions = {
Expand Down

0 comments on commit 5fdecce

Please sign in to comment.