Skip to content

Conversation

matt-metivier
Copy link
Contributor

@matt-metivier matt-metivier commented Sep 11, 2025

This PR introduces a new Terraform resource for managing Asserts thresholds configuration via the ThresholdsV2 API.

Changes

New Resource: grafana_asserts_thresholds

  • Manages request, resource, and health thresholds through bulk API endpoints
  • Supports three threshold types:
    • Request thresholds (error ratios, request rates)
    • Resource thresholds (saturation, resource utilization)
    • Health thresholds (service availability expressions)
  • Implements full CRUD operations with proper state management
  • Uses singleton pattern with fixed ID for global configuration management

API Client Updates

  • Updated grafana-asserts-public-clients from v0.0.0-20250811125322-247815da58ca to v0.0.0-20250911193242-e36893764a50
  • Migrated DisabledAlertConfigControllerAPI references to AlertConfigurationAPI due to API consolidation
  • Added support for ThresholdsV2 DTOs and endpoints

Technical Details

The resource implements a singleton pattern using a fixed ID (custom_thresholds) since thresholds represent global configuration rather than individual resources. The implementation includes proper error handling, retry logic, and state synchronization with the Asserts API.

Testing

  • Unit tests pass for all CRUD operations
  • Acceptance tests validate resource lifecycle and state management
  • Schema generation and documentation build successfully
  • Import functionality verified

Breaking Changes

None. This is a new resource addition with no impact on existing functionality.

@matt-metivier matt-metivier requested a review from a team as a code owner September 11, 2025 19:47
Copy link
Contributor

In order to lower resource usage and have a faster runtime, PRs will not run Cloud tests automatically.
To do so, a Grafana Labs employee must trigger the cloud acceptance tests workflow manually.

@matt-metivier matt-metivier self-assigned this Sep 11, 2025
@matt-metivier matt-metivier marked this pull request as draft September 11, 2025 20:43
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.

1 participant