-
Notifications
You must be signed in to change notification settings - Fork 269
4658:add custom model rules resource #2338
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
Conversation
In order to lower resource usage and have a faster runtime, PRs will not run Cloud tests automatically. |
2355088
to
a339fc4
Compare
8137144
to
dc9331d
Compare
9668de8
to
e742667
Compare
e1d0bb4
to
2fe501d
Compare
e742667
to
4ea55ad
Compare
2fe501d
to
f9c1ffc
Compare
6acbf8e
to
7a37321
Compare
feat(asserts): make custom model rules resource more Terraform native - Replace YAML string with structured blocks for better UX - Add conversion functions between Terraform blocks and API DTOs - Update schema to use nested blocks (rules -> entity -> defined_by) - Provide better IDE support, validation, and type safety - Update tests, documentation, and examples to use new format - Follow Terraform conventions similar to Kubernetes provider This addresses the PR feedback from Alex3k to make the resource more idiomatic and user-friendly while maintaining API compatibility. test: add stress test flag to control eventual consistency tests - Add CheckStressTestsEnabled function to testutils package - Update all stress tests to require TF_ACC_STRESS environment variable - Stress tests will now be skipped unless explicitly enabled - This prevents flaky stress test failures in CI while still allowing developers to run them when needed for testing eventual consistency feat(asserts): add custom model rules resource - Add grafana_asserts_custom_model_rules resource for managing Asserts custom model rules - Implement full CRUD operations with proper retry logic using shared utilities - Add comprehensive tests including stress tests for eventual consistency - Add documentation and usage examples - Update catalog configuration for the new resource - Register the new resource in the asserts resources list This resource allows users to define custom entity types and their detection rules using YAML configuration, enabling flexible monitoring model customization.
abb0ca5
to
afcecc7
Compare
9531ad4
to
e262306
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good! Sorry I'm late to the party. Just a small comment on enriched_by
doc
Optional: | ||
|
||
- `disabled` (Boolean) Whether this entity is disabled. | ||
- `enriched_by` (List of String) List of enrichment sources for the entity. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
enriched_by
has the same schema as defined_by
.
It's a PropertyRule
"enriched_by": { | ||
Type: schema.TypeList, | ||
Optional: true, | ||
Description: "List of enrichment sources for the entity.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be similar to defined_by
.
Something like:
List of queries that enrich entities of this type.
This PR introduces a new Terraform resource for managing Asserts custom model rules, enabling users to define custom entity types and their detection rules using YAML configuration.
Changes
New Resource:
grafana_asserts_custom_model_rules
Key Features
Technical Details
The resource implements proper retry logic using shared utilities to handle eventual consistency issues common with distributed systems. The implementation includes conversion functions between Terraform schema and API DTOs, ensuring proper data transformation and validation.
Testing
Breaking Changes
None. This is a new resource addition with no impact on existing functionality.