File tree Expand file tree Collapse file tree 3 files changed +40
-2
lines changed Expand file tree Collapse file tree 3 files changed +40
-2
lines changed Original file line number Diff line number Diff line change @@ -188,6 +188,11 @@ func ResourceDataSource() *schema.Resource {
188188 Optional : true ,
189189 Sensitive : true ,
190190 },
191+ "private_key" : {
192+ Type : schema .TypeString ,
193+ Optional : true ,
194+ Sensitive : true ,
195+ },
191196 "secret_key" : {
192197 Type : schema .TypeString ,
193198 Optional : true ,
@@ -369,6 +374,7 @@ func makeSecureJSONData(d *schema.ResourceData) gapi.SecureJSONData {
369374 AccessKey : d .Get ("secure_json_data.0.access_key" ).(string ),
370375 BasicAuthPassword : d .Get ("secure_json_data.0.basic_auth_password" ).(string ),
371376 Password : d .Get ("secure_json_data.0.password" ).(string ),
377+ PrivateKey : d .Get ("secure_json_data.0.private_key" ).(string ),
372378 SecretKey : d .Get ("secure_json_data.0.secret_key" ).(string ),
373379 TlsCACert : d .Get ("secure_json_data.0.tls_ca_cert" ).(string ),
374380 TlsClientCert : d .Get ("secure_json_data.0.tls_client_cert" ).(string ),
Original file line number Diff line number Diff line change @@ -257,6 +257,23 @@ resource "grafana_data_source" "testdata" {
257257 "json_data.0.query_timeout" : "1" ,
258258 },
259259 },
260+ {
261+ "grafana_data_source.stackdriver" ,
262+ `
263+ resource "grafana_data_source" "stackdriver" {
264+ type = "stackdriver"
265+ name = "stackdriver"
266+ secure_json_data {
267+ private_key = "-----BEGIN PRIVATE KEY-----\nprivate-key\n-----END PRIVATE KEY-----\n"
268+ }
269+ }
270+ ` ,
271+ map [string ]string {
272+ "type" : "stackdriver" ,
273+ "name" : "stackdriver" ,
274+ "secure_json_data.0.private_key" : "-----BEGIN PRIVATE KEY-----\n private-key\n -----END PRIVATE KEY-----\n " ,
275+ },
276+ },
260277}
261278
262279func TestAccDataSource_basic (t * testing.T ) {
Original file line number Diff line number Diff line change @@ -13,8 +13,8 @@ The data source resource allows a data source to be created on a Grafana server.
1313## Example Usage
1414
1515The required arguments for this resource vary depending on the type of data
16- source selected (via the ` type ` argument). The following example is for
17- InfluxDB. See [ Grafana's Data Sources Guides] [ datasources ] for more details on
16+ source selected (via the ` type ` argument). The following examples are for
17+ InfluxDB, CloudWatch, and Google Stackdriver . See [ Grafana's Data Sources Guides] [ datasources ] for more details on
1818the supported data source types and the arguments they use.
1919
2020[ datasources ] : https://grafana.com/docs/grafana/latest/features/datasources/
@@ -51,6 +51,19 @@ resource "grafana_data_source" "test_cloudwatch" {
5151}
5252```
5353
54+ For a Stackdriver datasource:
55+
56+ ``` hcl
57+ resource "grafana_data_source" "test_stackdriver" {
58+ type = "stackdriver"
59+ name = "sd-example"
60+
61+ secure_json_data {
62+ private_key = "-----BEGIN PRIVATE KEY-----\nprivate-key\n-----END PRIVATE KEY-----\n"
63+ }
64+ }
65+ ```
66+
5467## Argument Reference
5568
5669The following arguments are supported:
@@ -183,6 +196,8 @@ fields to operate properly.
183196
184197* ` password ` - (All) Password to use for authentication.
185198
199+ * ` private_key ` - (Stackdriver) The [ service account key] ( https://cloud.google.com/iam/docs/creating-managing-service-account-keys ) ` private_key ` to use to access the data source.
200+
186201* ` tls_ca_cert ` - (All) CA cert for out going requests.
187202
188203* ` tls_client_cert ` - (All) TLS Client cert for outgoing requests.
You can’t perform that action at this time.
0 commit comments