- Go 98.9%
- Makefile 0.8%
- Go Template 0.3%
| .github | ||
| docs | ||
| examples | ||
| grafana | ||
| templates | ||
| testdata | ||
| tools | ||
| vendor | ||
| .drone.jsonnet | ||
| .gitignore | ||
| .goreleaser.yml | ||
| CHANGELOG.md | ||
| docker-compose.tls.yml | ||
| docker-compose.yml | ||
| GNUmakefile | ||
| go.mod | ||
| go.sum | ||
| LICENSE | ||
| main.go | ||
| README.md | ||
Terraform Provider for Grafana
- Grafana website: https://grafana.com
- Provider Documentation: https://registry.terraform.io/providers/grafana/grafana/latest/docs
- Grafana Chat: Grafana #terraform Slack channel
Requirements
- Terraform 0.12+
Development
If you're new to provider development, a good place to start is the Extending Terraform docs.
Set up your local environment by installing Go. Also Docker can be used for running tests.
Running Tests
Acceptance tests require a running instance of Grafana. You can either handle
running an instance of Grafana yourself or use docker-compose.
If you choose docker-compose, run make testacc-docker. This is the simplest
option, but often not the quickest.
Alternatively you can use the testacc target which will use your local go
installation:
# Assuming Grafana was run with:
# docker run --rm -p 3000:3000 grafana/grafana
GRAFANA_URL=http://localhost:3000 \
GRAFANA_AUTH=admin:admin \
GRAFANA_ORG_ID=1 \
make testacc
Running enterprise tests
To run tests for resources which are available only for Grafana Enterprise, running instance of Grafana Enterprise is required. It is only possible to run tests for Grafana Enterprise using local environment.
# Assuming Grafana was run with:
# docker run --rm -p 3000:3000 grafana/grafana
GRAFANA_URL=http://localhost:3000 \
GRAFANA_AUTH=admin:admin \
GRAFANA_ORG_ID=1 \
make testacc-enterprise
Documentation
Documentation is generated with
tfplugindocs. Generated
files are in docs/ and should not be updated manually. They are derived from:
- Schema
Descriptionfields in the provider Go code. - examples/
- templates/
Use go generate to update generated docs.
Releasing
Builds and releases are automated with GitHub Actions and GoReleaser. The changelog is managed with github-changelog-generator.
Currently there are a few manual steps to this:
-
Update the changelog:
RELEASE_VERSION=v... \ CHANGELOG_GITHUB_TOKEN=... \ make changelogThis will commit the changelog locally.
-
Review generated changelog and push:
View the committed changelog with
git show. If all is wellgit push origin master. -
Kick off the release:
RELEASE_VERSION=v... \ make releaseOnce the command exits, you can monitor the rest of the process on the Actions UI.
-
Publish release:
The Action creates the release, but leaves it in "draft" state. Open it up in a browser and if all looks well, mash the publish button.