GoogleCloudPlatform / cloud-logging-data-source-plugin

https://grafana.com/grafana/plugins/googlecloud-logging-datasource/
Apache License 2.0
17 stars 12 forks source link

Authentificating datasource with grafana provisioning #76

Open icdef opened 3 months ago

icdef commented 3 months ago

The docs say, that the provisioning is similar to the Google Cloud Monitoring plugin for datasources However it does not support privateKeyPath and/or all the other fields in jsonData. Are they gonna be supported in the future? Something like this does not work, even though the private key is mounted. The other fields such as defaultProject or clientEmail are not set as well.

  - name: Google Cloud Logging
    type: googlecloud-logging-datasource
    access: proxy
    jsonData:
      tokenUri: tokenURI
      clientEmail: email@project.gserviceaccount.com
      authenticationType: jwt
      defaultProject: projectName
      privateKeyPath: /etc/secrets/privateKey.pem
mbrevda commented 2 months ago

Similar question regarding private key. For Google Cloud Monitoring, I pass:

 secureJsonData:
      privateKey: ${PROV_GCP_PRIVATE_KEY} # env var containing the service account's private key

When I pass this to this plugin, I get

google: could not parse key: private key should be a PEM or plain PKCS1 or PKCS8; parse error: asn1: structure error: tags don't match (16 vs {class:0 tag:13 length:45 isCompound:true}) {optional:false explicit:false application:false private:false defaultValue:<nil> tag:<nil> stringType:0 timeType:0 set:false omitEmpty:false} pkcs1PrivateKey @2

How can I set this up for provisioning?