{"id":18429725,"url":"https://github.com/joanlopez/terraform-grafana-example","last_synced_at":"2026-03-19T04:21:34.009Z","repository":{"id":185282114,"uuid":"673279202","full_name":"joanlopez/terraform-grafana-example","owner":"joanlopez","description":"Example repository with a Grafana dashboard defined with Terraform grafana/schemas provider and deployed with grafana/grafana provider","archived":false,"fork":false,"pushed_at":"2023-08-01T11:10:14.000Z","size":16,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-13T22:59:44.595Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/joanlopez.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-08-01T09:20:04.000Z","updated_at":"2023-08-01T09:40:43.000Z","dependencies_parsed_at":"2024-12-24T20:41:51.291Z","dependency_job_id":"265439be-ffd9-4157-bb56-038947c2355c","html_url":"https://github.com/joanlopez/terraform-grafana-example","commit_stats":null,"previous_names":["joanlopez/terraform-grafana-example"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/joanlopez/terraform-grafana-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joanlopez%2Fterraform-grafana-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joanlopez%2Fterraform-grafana-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joanlopez%2Fterraform-grafana-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joanlopez%2Fterraform-grafana-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joanlopez","download_url":"https://codeload.github.com/joanlopez/terraform-grafana-example/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joanlopez%2Fterraform-grafana-example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28700538,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-23T17:25:48.045Z","status":"ssl_error","status_checked_at":"2026-01-23T17:25:47.153Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T05:18:29.044Z","updated_at":"2026-01-23T21:52:29.451Z","avatar_url":"https://github.com/joanlopez.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Terraform Grafana example\n\n## Looking for building your own example?\n\n**If you're a [learning-by-doing](https://en.wikipedia.org/wiki/Learning-by-doing) kind of person,** you can follow the steps below to build your own example.\n\n### Pre-requisites\n\nFirst of all, you need to have these tools up and running before starting:\n\n- [Terraform](https://developer.hashicorp.com/terraform/downloads)\n- [Terraform Cloud](https://developer.hashicorp.com/terraform/tutorials/automation/github-actions) (*to store `.tfstate` files*)\n  - Alternatively, you can use any [Remote State](https://developer.hashicorp.com/terraform/language/state/remote) backend.\n  - Please, bear in mind that [you should not store `.tfstate` files locally in your repository](https://jhooq.com/terraform-do-not-store-tfstate-in-git/).\n- [Grafana Cloud](https://grafana.com/products/cloud/) instance (*with a [service account token](https://grafana.com/docs/grafana/latest/administration/service-accounts/#service-account-tokens) with enough permissions - e.g. admin*)\n\n### Step by step\n\n1. **Create a `main.tf` file** with a main definition:\n\n    ```terraform\n    terraform {\n      required_providers {\n        schemas = {\n          source  = \"grafana/schemas\"\n          version = \"0.2.0\"\n        }\n\n        grafana = {\n          source  = \"grafana/grafana\"\n          version = \"2.1.0\"\n        }\n      }\n    }\n\n    provider \"grafana\" {\n      url  = var.GRAFANA_URL\n      auth = var.GRAFANA_TOKEN\n    }\n    ```\n\n2. **Create a `vars.tf` file** with the variables' definition (*will be read from environment*):\n\n    ```terraform\n    variable \"GRAFANA_URL\" {\n      type        = string\n      description = \"Fully qualified domain name of your Grafana instance.\"\n    }\n\n    variable \"GRAFANA_TOKEN\" {\n      type        = string\n      description = \"Basic auth password or API token.\"\n    }\n    ```\n\n3. **Initialize** a new Terraform working directory:\n\n    ```sh\n    terraform init\n    ```\n\n4. **Create a `resources.tf` file** with a basic dashboard and the resource definition:\n\n    ```terraform\n    data \"schemas_core_dashboard\" \"example\" {\n      title = \"Terraform example\"\n      description = \"Example dashboard built with Terraform\"\n    }\n\n    resource \"grafana_dashboard\" \"example\" {\n      config_json = data.schemas_core_dashboard.example.rendered_json\n    }\n    ```\n\n5. **Set up Grafana and Terraform auth** as [Actions secrets](https://docs.github.com/en/actions/security-guides/encrypted-secrets):\n\n   - `GRAFANA_URL` with the root url of your instance\n   - `GRAFANA_TOKEN` with your service account token\n   - `TF_API_TOKEN` with your Terraform Cloud API token\n\n   Additionally, you may want to set up the following variables:\n\n   - `TF_CLOUD_ORGANIZATION` with the id of your Terraform cloud organization\n   - `TF_WORKSPACE` with the id of your Terraform cloud workspace\n\n## Contribute\n\nHave you detected a typo or something incorrect, and you are **willing to contribute?**\n\nPlease, [open a pull request](https://github.com/joanlopez/terraform-grafana-example/compare), and I'll be happy to review it.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoanlopez%2Fterraform-grafana-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoanlopez%2Fterraform-grafana-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoanlopez%2Fterraform-grafana-example/lists"}