Loading...
Loading...
Generate a copy-paste Grafana data source provisioning file (YAML or Terraform) for any plugin from its standardized settings schema on the plugins CDN. Use when the user wants to provision or configure a data source as code — e.g. "provision infinity", "datasource yaml for clickhouse", "terraform for the github datasource" — even when they only name the plugin and not the word "provisioning".
npx skill4agent add grafana/skills datasources-provisioning<org>-<name>-datasource-datasource-appyesoreyeram-infinity-datasourceinfinityclickhousefilter=<keyword>curl -s "https://grafana.com/api/plugins?filter=infinity" \
| jq -r '.items[] | "\(.slug)\t\(.name)"'
# → yesoreyeram-infinity-datasource Infinityyesoreyeram-infinity-datasourcecurl -s "https://grafana.com/api/plugins/yesoreyeram-infinity-datasource" | jq -r '.version'https://plugins-cdn.grafana.net/<PLUGIN_ID>/<VERSION>/public/plugins/<PLUGIN_ID>/schema/dsconfig.jsonID=yesoreyeram-infinity-datasource
VER=$(curl -s "https://grafana.com/api/plugins/$ID" | jq -r '.version')
curl -sf "https://plugins-cdn.grafana.net/$ID/$VER/public/plugins/$ID/schema/dsconfig.json"valueTypestringnumberbooleanarrayobjectmapanydsconfig.jsonkeyvalueTypetargetrootjsonDatasecureJsonDatavalidationsallowedValuesauth_methodschemaVersion: "v1"{
"pluginType": "yesoreyeram-infinity-datasource",
"fields": [
{
"key": "auth_method",
"valueType": "string",
"target": "jsonData",
"validations": [
{
"type": "allowedValues",
"values": [
"none",
"basicAuth",
"apiKey",
"bearerToken",
"oauth2",
"aws",
"azureBlob"
]
}
]
}
]
}descriptionv0alpha1.jsonhttps://plugins-cdn.grafana.net/<PLUGIN_ID>/<VERSION>/public/plugins/<PLUGIN_ID>/schema/v0alpha1.jsonID=yesoreyeram-infinity-datasource
VER=$(curl -s "https://grafana.com/api/plugins/$ID" | jq -r '.version')
curl -sf "https://plugins-cdn.grafana.net/$ID/$VER/public/plugins/$ID/schema/v0alpha1.json"settingsExamples.examplesapiKeyoauth2ClientCredentialssummarydescriptionvaluejsonDatasecureJsonData# list scenarios, then pull one payload
... | jq -r '.settingsExamples.examples | keys[]'
... | jq '.settingsExamples.examples.apiKey.value'schema/dsconfig.jsonNOTE: grafana-oss skill is available inplugin and also available as a standalone skill from the https://github.com/grafana/skills repositorygrafana-core
target | YAML | Terraform ( |
|---|---|---|
| top-level key on the datasource ( | top-level argument ( |
| under | key inside |
| under | key inside |
valueTypestringbooleantruefalsenumberoauth2awsallowedHostsscopesaccessrootproxydirectaccess_modegrafana/grafana| Choice | Produces |
|---|---|
| YAML config file | |
| Terraform | |
<name>provisioning/datasources/<name>.yamlapiVersion: 1
datasources:
- name: Infinity # must be unique across the instance — collides even with a different datasource type
type: yesoreyeram-infinity-datasource # = pluginType from the schema
access: proxy # always set; default proxy (route queries through the Grafana server)
uid: infinity-ds # also unique and immutable so dashboards can reference it
jsonData:
auth_method: apiKey # value from validations.allowedValues
apiKeyKey: X-API-Key
apiKeyType: header
allowedHosts:
- https://api.example.com
secureJsonData:
apiKeyValue: ${API_KEY} # env var ref, never a literal secret
editable: false<name>.tfvariable "api_key" {
type = string
sensitive = true
}
resource "grafana_data_source" "infinity" {
type = "yesoreyeram-infinity-datasource"
name = "Infinity"
uid = "infinity-ds"
access_mode = "proxy" # always set; default proxy (route queries through the Grafana server)
json_data_encoded = jsonencode({
auth_method = "apiKey"
apiKeyKey = "X-API-Key"
apiKeyType = "header"
allowedHosts = ["https://api.example.com"]
})
secure_json_data_encoded = jsonencode({
apiKeyValue = var.api_key
})
}grafana_data_sourcegrafana/grafanaaccess_modejson_data_encodedsecure_json_data_encodedrequired_providersprovider "grafana"provisioning/datasources/<name>.yamlterraform applycurl -s https://grafana.example.com/api/datasources/uid/<uid>/health \
-H "Authorization: Bearer <token>"
# { "status": "OK" } → working
# { "status": "ERROR" } → URL unreachable or auth misconfigured<https://grafana.example.com>/connections/datasources/edit/<uid>list_datasourcesget_datasourceuidnametypeuidurlaccessbasicAuthbasicAuthUserjsonDatasecureJsonFields{"apiKeyValue": true}${ENV_VAR}secureJsonDatatruetarget