Create a Grafana Cloud Free account. No credit card required.
You can set OpenTofu the way you want. If you never did that, here are the steps you can follow:
tofu init
We will deploy:
To do that, use the following command:
tofu apply -var 'grafana_url=<CHANGE ME>' -var 'my_token=<CHANGE ME>' -var 'my_email=<CHANGE ME>'
OpenTofu will ask you to confirm. Type yes
.
Replace the values for grafana_url
and my_token
with the right values for your environment:
grafana_url
should look like https://mystack.grafana.net/ in Grafana Cloud (or other domains if you use OSS or Enterprise)my_token
is the API token you createdmy_email
is the email address to receive alerts (don't worry, the alert rule never fires in this example)You can now visit your instance and check that the folder, dashboard, and alerts are present.
You may found no data in your dashboard when opening it. You need to reload the page as your browser cache prevents the webapp to use the new datasource.
As Code is great because cleaning up your tests are also very fast !
With the same values, run:
tofu destroy -var 'grafana_url=<CHANGE ME>' -var 'my_token=<CHANGE ME>'
To fully cleanup the environment, you can also remove the Service Account you created manually.
Some useful ressources from Grafana Labs and friends: