Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aws_cloudwatch_metric alarm validate return_data flag on metric_query blocks #29925

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

teddylear
Copy link
Contributor

@teddylear teddylear commented Mar 12, 2023

Description

aws_cloudwatch_metric alarm validate return_data flag on metric_query blocks.

Please let me know if you want me to squash commits or change anything here.

Closes #29894

Output from Acceptance Testing

Please ignore shell line numbers

  terraform-provider-aws on  f-aws_cloudwatch_metric_alarm-validate_return_data_flag [!] via 🐹 v1.18.4
   21 [I] ➜ make testacc TESTS=TestAccCloudWatchMetricAlarm_missingReturnDataFromMetricQuery PKG=cloudwatch
   20 ==> Checking that code complies with gofmt requirements...
   19 TF_ACC=1 go test ./internal/service/cloudwatch/... -v -count 1 -parallel 20 -run='TestAccCloudWatchMetricAlarm_missingReturnDataFromMetricQu
   18 ery'  -timeout 180m
   17 === RUN   TestAccCloudWatchMetricAlarm_missingReturnDataFromMetricQuery
   16 === PAUSE TestAccCloudWatchMetricAlarm_missingReturnDataFromMetricQuery
   15 === CONT  TestAccCloudWatchMetricAlarm_missingReturnDataFromMetricQuery
   14 --- PASS: TestAccCloudWatchMetricAlarm_missingReturnDataFromMetricQuery (4.27s)
   13 PASS
   12 ok      github.com/hashicorp/terraform-provider-aws/internal/service/cloudwatch 4.361s
   11
   10 terraform-provider-aws on  f-aws_cloudwatch_metric_alarm-validate_return_data_flag [!] via 🐹 v1.18.4 took 38s
    9 [I] ➜ make testacc TESTS=TestAccCloudWatchMetricAlarm_moreThanOneReturnDataFromMetricQuery PKG=cloudwatch
    8 ==> Checking that code complies with gofmt requirements...
    7 TF_ACC=1 go test ./internal/service/cloudwatch/... -v -count 1 -parallel 20 -run='TestAccCloudWatchMetricAlarm_moreThanOneReturnDataFromMetr
    6 icQuery'  -timeout 180m
    5 === RUN   TestAccCloudWatchMetricAlarm_moreThanOneReturnDataFromMetricQuery
    4 === PAUSE TestAccCloudWatchMetricAlarm_moreThanOneReturnDataFromMetricQuery
    3 === CONT  TestAccCloudWatchMetricAlarm_moreThanOneReturnDataFromMetricQuery
    2 --- PASS: TestAccCloudWatchMetricAlarm_moreThanOneReturnDataFromMetricQuery (4.30s)
    1 PASS
  293 ok      github.com/hashicorp/terraform-provider-aws/internal/service/cloudwatch 4.385s

@github-actions
Copy link

Community Note

Voting for Prioritization

  • Please vote on this pull request by adding a 👍 reaction to the original post to help the community and maintainers prioritize this pull request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

For Submitters

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • For new resources and data sources, use skaff to generate scaffolding with comments detailing common expectations.
  • Whether or not the branch has been rebased will not impact prioritization, but doing so is always a welcome surprise.

@github-actions github-actions bot added service/cloudwatch Issues and PRs that pertain to the cloudwatch service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. needs-triage Waiting for first response or review from a maintainer. size/M Managed by automation to categorize the size of a PR. labels Mar 12, 2023
@github-actions github-actions bot added the documentation Introduces or discusses updates to documentation. label Mar 12, 2023
@teddylear teddylear marked this pull request as ready for review March 12, 2023 20:21
@teddylear teddylear changed the title [WIP] aws_cloudwatch_metric alarm validate return_data flag on metric_query blocks aws_cloudwatch_metric alarm validate return_data flag on metric_query blocks Mar 12, 2023
@justinretzolk justinretzolk added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Mar 14, 2023
@gdavison gdavison self-assigned this Mar 18, 2023
@teddylear
Copy link
Contributor Author

@gdavison Updated to resolve merge conflict. Looks like all checks are passing except one that I believe is failing on master. If there is anything else I should change here please let me know or feel free to update PR. Thanks for review in advance!

@teddylear
Copy link
Contributor Author

@gdavison Updated PR again with main branch it it looks like all CI checks pass now. Please let me know if there's anything else I should, or feel free to update branch.

@gdavison
Copy link
Contributor

Hi @teddylear, I'm finally getting back to this. I noticed that TestAccCloudWatchMetricAlarm_metricQuery is failing now on step 12/13, with the error

Error: updating CloudWatch Metric Alarm (tf-acc-test-4436216504270192469): Multiple metric_query blocks have return_data as true for a cloudwatch metric alarm

However, when I removed the second return_data, I get the error

Error: updating CloudWatch Metric Alarm (tf-acc-test-8921213070741916919): operation error CloudWatch: PutMetricAlarm, https response error StatusCode: 400, RequestID: d8eff146-644b-4195-93bd-fd3509ef1252, api error ValidationError: Exactly two elements of the metrics list should return data.

which is returned by the AWS API. It looks like the logic for how many return_data parameters are allowed is somewhat more complicated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Addresses a defect in current functionality. documentation Introduces or discusses updates to documentation. service/cloudwatch Issues and PRs that pertain to the cloudwatch service. size/M Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: aws_cloudwatch_metrics_alarm validation, exactly one metric_query must have return_data set to true
3 participants