Skip to content

Conversation

clementduveau
Copy link

@clementduveau clementduveau commented May 23, 2025

Hello there 👋

This is a "simple" implementation of Grafana Cloud Integrations in the Terraform provider.

Integrations don't have an OpenAPI specs (because they rely on the webclient to create the dashboards, it's a mix), nor they have a client (AFAIK). So the client relies on direct API calls for the "easy start" part.

What works and have been tested:

  • Installing integrations
  • Installing with/without alerts or logs
  • Disabling integration
  • import

What I didn't test or even tried:

  • Adding a datasource (because why ?)

What could be improved

  • Update integrations ? I guess it should be an option like always-try-update to consider than the resource needs a change, forcing the upgrade.
  • Unit tests. I tested manually everything as I didn't know how to write tests for Cloud

EDIT: tested more things

@clementduveau clementduveau requested a review from a team as a code owner May 23, 2025 17:38
@clementduveau
Copy link
Author

Solves #1917

@clementduveau
Copy link
Author

Since it's been a while, I just want to add some documentation around how it works, otherwise I will forget.

When someone wants to install the integration, they click on the "Install dashboard and alerts" button. The chain of action:

  • An API call is made to an endpoint. This endpoint will install the recording rules and alert rules as well as changing the integration status to enabled
  • Another API call is made to retrieve some metadata about the integrations (id, name, folder, a URL to find the dashboards)
  • The web client call the URL to get the dashboards JSON
  • The web client push the JSON into the folder

So the client is the one doing most of the installation. This terraform ressources does that the same way.

When uninstalling, it's pretty much the same thing, but instead of getting the JSON, it just removes the folder with the dashboards and call the endpoint to disable & remove alerts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant