-
Notifications
You must be signed in to change notification settings - Fork 236
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
SLO: Implements SLO Datasource and SLO Resource #890
Conversation
…eSLO functionality for the ResourceSLOCreate and ResourceSLORead Methods
…onality for the resourceSloDelete Methods
…onality for the resourceSloUpdate method, removes the Local Dev Testing Files
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 promote the Drone build. For maintainers, it's better to run only the Cloud tests you need, rather than all of them. You can do so by setting the following parameter when promoting:
|
go.mod
Outdated
@@ -2,6 +2,8 @@ module github.com/grafana/terraform-provider-grafana | |||
|
|||
go 1.18 | |||
|
|||
replace github.com/grafana/grafana-api-golang-client => /Users/elainevuong/go/src/github.com/grafana/grafana-api-golang-client |
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.
TODO: needs to be removed upon final commit
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.
You can do a replace with your actual branch from github and that way we'll see if tests here run correctly
GNUmakefile
Outdated
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.
Was this auto-formatted? I like files better with a newline at the end 🤔
Computed: true, | ||
Description: `Returns a list of all SLOs"`, | ||
Elem: &schema.Resource{ | ||
Schema: map[string]*schema.Schema{ |
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.
Did you try using the common.CloneResourceSchemaForDatasource
function to build this schema? Normally, we re-use the schema from the resource. Easier to maintain
FreeformQuery: generateFreeformQuery(freeformQuery), | ||
// GroupByLabels: generateQueryLabels(querylabelsstruct), | ||
FreeformQuery: packFreeformQuery(freeformQuery), | ||
GroupByLabels: packQueryLabels(queryLabelsStruct), |
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 didn't think we could use GroupByLabels with the FreeFormQuery... wouldn't that imply that we'd be modifying the FreeFormQuery to add some additional aggregation / grouping?
Do you have an example where this is needed
Required: true, | ||
Description: `Description is a free-text field that can provide more context to an SLO.`, | ||
}, | ||
"query": &schema.Schema{ |
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.
Because of discussions we've had in the team about the various query schemas, let's strip out everything except freeform from this schema. That will protect the provider from any near-term refactoring that we have to do.
This Draft PR implements a SLO Datasource (READ) and a SLO Resource (CRUD + Import) to the Grafana Terraform Provider.
Needs to be reviewed in conjunction with this PR on the Grafana Go API Client
For anyone who wants to test this on sloapp, feel free to check out the instructions within slo-testing-README.md within the slo_testing directory.
Detailed steps are provided for testing the TF Provider CRUD and Import Functionality.