-
Notifications
You must be signed in to change notification settings - Fork 263
4648: Add Asserts provider support for custom models configurations #2297
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
Open
matt-metivier
wants to merge
52
commits into
main
Choose a base branch
from
4648
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In order to lower resource usage and have a faster runtime, PRs will not run Cloud tests automatically. |
4565: Updating stack id docs 4565: fixing test 4565: running test and fixing comment 4565: owner update 4565: fixing path Fix concurrency race condition in generate tool Fix 'panic: send on closed channel' error in generateImportBlocks. The issue was a classic Go concurrency race condition: - Goroutines called wg.Done() before sending to results channel - Main goroutine could close(results) while sends were still pending - This caused 'send on closed channel' panics Fix: Move all 'results <- result{}' sends BEFORE wg.Done() calls to ensure all channel operations complete before waitgroup finishes. This prevents the channel from being closed while goroutines are still trying to send results. Fixes integration test failures in CI. Add dedicated environment check for Asserts service tests Create CheckAssertsTestsEnabled() function to properly gate Asserts tests. Tests now require TF_ACC_ASSERTS=true to run, preventing 404 errors when Asserts service is not available in test environments. This follows the same pattern as other optional cloud services and ensures tests only run when the service is actually configured. Fix linter error: remove unused getTestStackIDForDisabled function Removed duplicate getTestStackIDForDisabled function and unnecessary imports. Both test files now share the getTestStackID function from the same package. Fixes: - unused function (golangci-lint) - unnecessary imports (os, strconv, require) All tests still pass and linter is clean. 4565: adding test 4565: adding test 4565: adding to catalog Update asserts resources and configuration 4565: fixing client 4565: update to add stack_id 4565: small revert 4565: Setup for asserts TF
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🎯 Overview
Extends Terraform provider support for managing Asserts configurations through Grafana Cloud by adding a resource for Custom Model Rules. This implementation uses the existing integration with the Grafana Asserts App Plugin, leveraging Grafana Service Account authentication and stack-scoped API calls.
🚀 Features Added
Resources Implemented
grafana_asserts_custom_model_rules
- Manages custom model rule configurations.Authentication & Architecture
X-Scope-OrgID
headersgrafana-asserts-public-clients/go/gcom
🏗️ Architecture
API Flow:
Plugin API Gateway Endpoint:
Key Implementation Details:
github.com/grafana/grafana-asserts-public-clients/go/gcom
Headers Used:
Authorization: Bearer {token}
X-Scope-OrgID: {stackID}
Content-Type: application/json
💻 Example Usage
📁 Files Added/Modified
New Files
internal/resources/asserts/resource_custom_model_rules.go
- Custom Model Rules resourceinternal/resources/asserts/resource_custom_model_rules_test.go
- Custom Model Rules testsexamples/resources/grafana_asserts_custom_model_rules/resource.tf
- Example for Custom Model Rulesdocs/resources/asserts_custom_model_rules.md
- Generated documentationModified Files
internal/resources/asserts/resources.go
- Registered the new resourceinternal/resources/asserts/catalog-resource.yaml
- Added Backstage catalog entry for the new resourcego.mod
/go.sum
- Updatedgrafana-asserts-public-clients
dependencyTest Categories
Running Tests
🔧 Implementation Notes
Client Configuration
The Asserts client is configured to:
/api/plugins/grafana-asserts-app/resources/asserts/api-server
.Plugin Integration
Resource Configuration
stack_id
from the provider configuration (no per-resource stack ID needed).Error Handling
📚 Dependencies
github.com/grafana/grafana-asserts-public-clients/go/gcom
- Generated API client🔐 Security & Permissions
X-Scope-OrgID
headers.