Skip to content

Commit 7735dd4

Browse files
Docs: Add sections for local dev of provider and together w. client (#876)
* update readme w. local dev instructions * Update README.md Co-authored-by: Julien Duchesne <[email protected]> * Update README.md Co-authored-by: Julien Duchesne <[email protected]> --------- Co-authored-by: Julien Duchesne <[email protected]>
1 parent 7b30dd4 commit 7735dd4

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,31 @@ Terraform](https://www.terraform.io/docs/extend/index.html) docs.
2323
Set up your local environment by installing [Go](http://www.golang.org). Also
2424
[Docker](https://docs.docker.com/install/) can be used for running tests.
2525

26+
## Local Development with Frafana
27+
If you develop the provider and want to test locally with your grafana provider
28+
1. create a `.terraformrc` and paste the following
29+
```
30+
provider_installation {
31+
dev_overrides {
32+
"grafana/grafana" = "/path/to/your/grafana/terraform-provider" # this path is the diretory where the binary is built
33+
}
34+
# For all other providers, install them directly from their origin provider
35+
# registries as normal. If you omit this, Terraform will _only_ use
36+
# the dev_overrides block, and so no other providers will be available.
37+
direct {}
38+
}
39+
```
40+
2. Run `go build` in this directory to get the binary, Terraform will use the binary you just built (it should print out a warning)
41+
42+
## Testing the `grafana-api-golang-client` Together with the Terraform Provider
43+
As for testing the client, make a branch and open the provider PR with a `TODO:` to remove the replace operator, because the best way to test the changes you just made in the client is to integrate everything in the provider
44+
45+
1. create a branch `api-client-branchname` with your changes
46+
2. modify the provider `go.mod`:
47+
- replace github.com/grafana/grafana-api-golang-client => github.com/grafana/grafana-api-golang-client <api-client-branchname>
48+
3. run `go mod tidy` in this directory
49+
4. pushing allows you to run the provider tests in CI
50+
2651
### Running Tests
2752

2853
Acceptance tests require a running instance of Grafana. You can either handle

0 commit comments

Comments
 (0)