Skip to content

Commit a67e4a2

Browse files
Support tracingDatasourceUid for Cloudwatch datasource (#505)
* Support `tracingDatasourceUid` for Cloudwatch datasource Closes #462 * Generate docs
1 parent 43b28cb commit a67e4a2

File tree

5 files changed

+22
-3
lines changed

5 files changed

+22
-3
lines changed

docs/resources/data_source.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ Optional:
157157
- `tls_configuration_method` (String) (All) SSL Certificate configuration, either by ‘file-path’ or ‘file-content’.
158158
- `tls_skip_verify` (Boolean) (All) Controls whether a client verifies the server’s certificate chain and host name.
159159
- `token_uri` (String) (Stackdriver) The token URI used, provided in the service account key.
160+
- `tracing_datasource_uid` (String) (Cloudwatch) The X-Ray datasource uid to associate to this Cloudwatch datasource.
160161
- `tsdb_resolution` (Number) (OpenTSDB) Resolution.
161162
- `tsdb_version` (Number) (OpenTSDB) Version.
162163
- `version` (String) (InfluxDB) InfluxQL or Flux.

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.18
55
require (
66
github.com/Masterminds/semver/v3 v3.1.1
77
github.com/grafana/amixr-api-go-client v0.0.1
8-
github.com/grafana/grafana-api-golang-client v0.5.2
8+
github.com/grafana/grafana-api-golang-client v0.5.3
99
github.com/grafana/machine-learning-go-client v0.1.1
1010
github.com/grafana/synthetic-monitoring-agent v0.8.2
1111
github.com/grafana/synthetic-monitoring-api-go-client v0.6.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
114114
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
115115
github.com/grafana/amixr-api-go-client v0.0.1 h1:vj5gNxZ1LC3Yu6AavRfDKdqzq1h4WR5wXZEyHLaGkm8=
116116
github.com/grafana/amixr-api-go-client v0.0.1/go.mod h1:N6x26XUrM5zGtK5zL5vNJnAn2JFMxLFPPLTw/6pDkFE=
117-
github.com/grafana/grafana-api-golang-client v0.5.2 h1:QKRXxLoThdQXtJp6TLCyaY0aW0Z9IDT9/udHhfhhovQ=
118-
github.com/grafana/grafana-api-golang-client v0.5.2/go.mod h1:24W29gPe9yl0/3A9X624TPkAOR8DpHno490cPwnkv8E=
117+
github.com/grafana/grafana-api-golang-client v0.5.3 h1:QoIesfzqt4Ges7ocNDatHIBRjagGInOJ50LSIfzPmp4=
118+
github.com/grafana/grafana-api-golang-client v0.5.3/go.mod h1:24W29gPe9yl0/3A9X624TPkAOR8DpHno490cPwnkv8E=
119119
github.com/grafana/machine-learning-go-client v0.1.1 h1:Gw6cX8xAd6IVF2LApkXOIdBK8Gzz07B3jQPukecw7fc=
120120
github.com/grafana/machine-learning-go-client v0.1.1/go.mod h1:QFfZz8NkqVF8++skjkKQXJEZfpCYd8S0yTWJUpsLLTA=
121121
github.com/grafana/synthetic-monitoring-agent v0.8.2 h1:retJc4xWxoHwqhWa4HZ9t4mO+Je0DWm8wCGdPW2hmuw=

grafana/resource_data_source.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,11 @@ source selected (via the 'type' argument).
398398
Optional: true,
399399
Description: "(Stackdriver) The token URI used, provided in the service account key.",
400400
},
401+
"tracing_datasource_uid": {
402+
Type: schema.TypeString,
403+
Optional: true,
404+
Description: "(Cloudwatch) The X-Ray datasource uid to associate to this Cloudwatch datasource.",
405+
},
401406
"tsdb_resolution": {
402407
Type: schema.TypeInt,
403408
Optional: true,
@@ -729,6 +734,7 @@ func makeJSONData(d *schema.ResourceData) gapi.JSONData {
729734
TLSConfigurationMethod: d.Get("json_data.0.tls_configuration_method").(string),
730735
TLSSkipVerify: d.Get("json_data.0.tls_skip_verify").(bool),
731736
TokenURI: d.Get("json_data.0.token_uri").(string),
737+
TracingDatasourceUID: d.Get("json_data.0.tracing_datasource_uid").(string),
732738
TsdbResolution: int64(d.Get("json_data.0.tsdb_resolution").(int)),
733739
TsdbVersion: int64(d.Get("json_data.0.tsdb_version").(int)),
734740
Version: d.Get("json_data.0.version").(string),

grafana/resource_data_source_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ func TestAccDataSource_basic(t *testing.T) {
263263
assume_role_arn = "arn:aws:sts::*:assumed-role/*/*"
264264
custom_metrics_namespaces = "foo"
265265
external_id = "abc123"
266+
tracing_datasource_uid = "my-datasource-uid"
266267
}
267268
secure_json_data {
268269
access_key = "123"
@@ -281,6 +282,17 @@ func TestAccDataSource_basic(t *testing.T) {
281282
"secure_json_data.0.access_key": "123",
282283
"secure_json_data.0.secret_key": "456",
283284
},
285+
additionalChecks: []resource.TestCheckFunc{
286+
func(s *terraform.State) error {
287+
if dataSource.Name != "cloudwatch" {
288+
return fmt.Errorf("bad name: %s", dataSource.Name)
289+
}
290+
if dataSource.JSONData.TracingDatasourceUID != "my-datasource-uid" {
291+
return fmt.Errorf("bad tracing_datasource_uid: %s", dataSource.JSONData.TracingDatasourceUID)
292+
}
293+
return nil
294+
},
295+
},
284296
},
285297
{
286298
resource: "grafana_data_source.mssql",

0 commit comments

Comments
 (0)