Skip to content

[datadog_security_monitoring_rule] Prevent API-echoed metric field from causing apply inconsistency#3802

Open
alvizi-dd wants to merge 1 commit into
masterfrom
yuri/NO-JIRA-fix-metric-field-echoed-from-metrics
Open

[datadog_security_monitoring_rule] Prevent API-echoed metric field from causing apply inconsistency#3802
alvizi-dd wants to merge 1 commit into
masterfrom
yuri/NO-JIRA-fix-metric-field-echoed-from-metrics

Conversation

@alvizi-dd
Copy link
Copy Markdown
Contributor

@alvizi-dd alvizi-dd commented May 19, 2026

Summary

  • Extends reconcileEmptyQueryFields to handle the deprecated metric field
  • The Datadog API derives and echoes back metric from the metrics list even when the user never configured metric. Since metric is Optional (not Computed), the framework plans it as null when not configured. The API echo caused a "provider produced inconsistent result" error after apply.
  • Fix: when the prior plan/state had metric = null, restore it to null after reading the API response, regardless of the echoed value.

Test plan

  • Verify rules using only metrics (not metric) apply without inconsistency error
  • Verify rules using the deprecated metric field still work correctly
  • Verify import of existing rules works (defaults to null for unconfigured metric)

@datadog-prod-us1-5

This comment has been minimized.

@alvizi-dd alvizi-dd changed the title [NO JIRA] Prevent API-echoed metric field from causing apply inconsistency [datadog_security_monitoring_rule] Prevent API-echoed metric field from causing apply inconsistency May 19, 2026
@alvizi-dd alvizi-dd force-pushed the yuri/NO-JIRA-fix-metric-field-echoed-from-metrics branch from 109426d to b32d3c0 Compare May 19, 2026 12:31
@alvizi-dd alvizi-dd marked this pull request as ready for review May 19, 2026 14:40
@alvizi-dd alvizi-dd requested a review from a team as a code owner May 19, 2026 14:40
@alvizi-dd alvizi-dd force-pushed the yuri/NO-JIRA-fix-metric-field-echoed-from-metrics branch from b32d3c0 to b5987fc Compare May 20, 2026 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant