Skip to content
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

Closed
wants to merge 55 commits into from

Conversation

elainevuong
Copy link
Contributor

@elainevuong elainevuong commented Apr 19, 2023

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.

…eSLO functionality for the ResourceSLOCreate and ResourceSLORead Methods
…onality for the resourceSloUpdate method, removes the Local Dev Testing Files
@elainevuong elainevuong requested a review from a team as a code owner April 19, 2023 17:22
@CLAassistant
Copy link

CLAassistant commented Apr 19, 2023

CLA assistant check
All committers have signed the CLA.

@github-actions
Copy link

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:

TESTARGS='-run=<testname>'

@elainevuong elainevuong marked this pull request as draft April 19, 2023 17:24
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
Copy link
Contributor Author

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

Copy link
Member

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

@elainevuong elainevuong marked this pull request as ready for review April 27, 2023 14:31
GNUmakefile Outdated
Copy link
Member

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 🤔

docs/resources/slo.md Outdated Show resolved Hide resolved
docs/data-sources/slo.md Outdated Show resolved Hide resolved
Computed: true,
Description: `Returns a list of all SLOs"`,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
Copy link
Member

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

internal/resources/slo/data_source_slo_test.go Outdated Show resolved Hide resolved
internal/resources/slo/data_source_slo_test.go Outdated Show resolved Hide resolved
FreeformQuery: generateFreeformQuery(freeformQuery),
// GroupByLabels: generateQueryLabels(querylabelsstruct),
FreeformQuery: packFreeformQuery(freeformQuery),
GroupByLabels: packQueryLabels(queryLabelsStruct),
Copy link
Contributor

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

@elainevuong elainevuong marked this pull request as draft May 1, 2023 21:24
Required: true,
Description: `Description is a free-text field that can provide more context to an SLO.`,
},
"query": &schema.Schema{
Copy link
Contributor

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.

@elainevuong elainevuong closed this May 3, 2023
@elainevuong elainevuong deleted the elainevuong/slo branch October 30, 2023 18:14
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.

5 participants