simPod / GrafanaJsonDatasource

Grafana datasource to load JSON data over your arbitrary HTTP backend
https://grafana.com/grafana/plugins/simpod-json-datasource/
MIT License
355 stars 72 forks source link

Terraform resource definition #633

Closed GunFood closed 3 weeks ago

GunFood commented 2 months ago

We try to configure Grafana using Terraform so it was a challenge to find the correct variables (still have not found some, for example withCredentials).

But I think it might be a good starting point and maybe something to add to the documentation. As I have more than one JSON source, I've put it into a for each, so you can call the module with an list object to have multiple of them configured.

resource "grafana_data_source" "json-datasource" {
    for_each = { for each in var.json-datasources : each.name => each }
    type = "simpod-json-datasource"
    uid = each.value.uid
    name = each.value.name
    url = each.value.url
    basic_auth_enabled  = true
    basic_auth_username = each.value.username

    json_data_encoded = jsonencode (
        {
            tlsSkipVerify = true
            withCredentials = true #not working
        }
    )
    secure_json_data_encoded = jsonencode (
        {
            basicAuthPassword = each.value.secret
        }
    )
}

Thanks for your work.

simPod commented 2 months ago

I have no personal experience with TF but PR is welcome. Can be added to docs/ with some disclaimer.

github-actions[bot] commented 4 weeks ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

github-actions[bot] commented 3 weeks ago

This issue has not seen any activity since it was marked stale. Closing.