Skip to content

monitoring: clarify comparison enum doc for alert policy (#16862)#65

Open
jbbqqf wants to merge 12 commits into
mainfrom
feat/16862-monitoring-comparison-docs
Open

monitoring: clarify comparison enum doc for alert policy (#16862)#65
jbbqqf wants to merge 12 commits into
mainfrom
feat/16862-monitoring-comparison-docs

Conversation

@jbbqqf
Copy link
Copy Markdown
Owner

@jbbqqf jbbqqf commented May 9, 2026

Summary

Documentation fix on google_monitoring_alert_policy. The Cloud Monitoring API only supports COMPARISON_LT and COMPARISON_GT for condition_threshold.comparison and conditions[].condition_sql.row_count_test.comparison, but the registry docs presents all six enum values without clearly flagging the API limitation, so users set COMPARISON_GE (and friends) and get an API error back.

Fixes hashicorp/terraform-provider-google#16862 — see hashicorp/terraform-provider-google#16862

Why

The maintainer (shuyama1) acknowledged this in 2023:

Sorry for the misleading documentation. Looks like the API only supports COMPARISON_LT and COMPARISON_GT currently (API doc). We'll correct the documentation for available values.

…but the doc cleanup was never shipped. Users continue to hit the same trap (the latest comment on the issue, with screenshot, is from 2025).

This PR rewords the field descriptions to lead with the API limitation and link the canonical reference, so the registry doc is unambiguous. The enum value list is intentionally left intact so already-imported state that happens to contain non-LT/GT values doesn't error out at parse time; the API remains the authoritative gate.

GCP API reference:

What changed

mmv1 source — single file:

 mmv1/products/monitoring/AlertPolicy.yaml | 27 +++++++++++++++++----------

Two comparison field descriptions are reworded:

  • conditions[].condition_threshold.comparison
  • conditions[].condition_sql.row_count_test.comparison

The downstream impact after regeneration is registry-doc text only — Description strings on the schema. No validation change, no plan/apply behavior change.

Edge cases tested

# Scenario HCL excerpt Expected Verified by
1 LT/GT (supported) comparison = "COMPARISON_LT" Plan + apply succeed (unchanged from today) static — no path change
2 GE/LE/EQ/NE (unsupported) comparison = "COMPARISON_GE" Plan succeeds (validation passes), API returns the same error as today static — enum_values list intentionally kept
3 Imported state with non-LT/GT value preexisting tfstate with COMPARISON_GE Plan/refresh does not error at parse time enum_values list intentionally kept

Test protocol

Test Result Notes
YAML well-formedness review pass both comparison blocks rewritten consistently
API premise confirmed linked Monitoring REST docs and maintainer ack

This is a doc-only change (description text). No live smoke was run because the change does not alter plan/apply behavior, validation, or payload shape — it only changes the doc string surfaced in the registry. The reviewer can compare before/after by re-rendering the registry doc page from the regenerated provider.

Resources

Disclosure

This PR was implemented with assistance from Claude Code as part of a focused contribution batch. The diff was reviewed manually against the GCP API documentation linked above. The author (a human) reviewed the diff and the API-premise check before opening this PR.

jcromanu and others added 12 commits May 8, 2026 16:43
…Platform#16862)

The Cloud Monitoring API only supports COMPARISON_LT and COMPARISON_GT
for MetricThreshold conditions and SqlCondition row-count tests, but
the schema description merely tacked that information on at the end of
a long paragraph; the registry doc still leads with all six possible
values, surprising users who set COMPARISON_GE and get an API error
back.

Reword the descriptions for both `condition_threshold.comparison` and
`condition_sql.row_count_test.comparison` to lead with the API
limitation and link to the canonical reference. Leave the enum_values
list untouched so existing imported state with non-LT/GT values keeps
parsing — the API itself remains the authoritative gate.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unable to create an alert policy with COMPARISON_GE

8 participants