Skip to content

Commit c78bdc7

Browse files
authored
Add implementation in data source (#454) (#455)
* Adds support for the "implementation" field of the json_data block of the grafana_data_source resource. This allows users to specify the Alertmanager implementation when installing an Alertmanager data source resource. Closes: #454
1 parent bbbdef2 commit c78bdc7

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

docs/resources/data_source.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ Optional:
123123
- `github_url` (String) (Github) Github URL
124124
- `graphite_version` (String) (Graphite) Graphite version.
125125
- `http_method` (String) (Prometheus) HTTP method to use for making requests.
126+
- `implementation` (String) (Alertmanager) Implementation of Alertmanager. Either 'cortex' or 'prometheus'
126127
- `interval` (String) (Elasticsearch) Index date time format. nil(No Pattern), 'Hourly', 'Daily', 'Weekly', 'Monthly' or 'Yearly'.
127128
- `log_level_field` (String) (Elasticsearch) Which field should be used to indicate the priority of the log message.
128129
- `log_message_field` (String) (Elasticsearch) Which field should be used as the log message.

grafana/resource_data_source.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,11 @@ source selected (via the 'type' argument).
247247
Optional: true,
248248
Description: "(Elasticsearch) Index date time format. nil(No Pattern), 'Hourly', 'Daily', 'Weekly', 'Monthly' or 'Yearly'.",
249249
},
250+
"implementation": {
251+
Type: schema.TypeString,
252+
Optional: true,
253+
Description: "(Alertmanager) Implementation of Alertmanager. Either 'cortex' or 'prometheus'",
254+
},
250255
"log_level_field": {
251256
Type: schema.TypeString,
252257
Optional: true,
@@ -694,6 +699,7 @@ func makeJSONData(d *schema.ResourceData) gapi.JSONData {
694699
GraphiteVersion: d.Get("json_data.0.graphite_version").(string),
695700
HTTPMethod: d.Get("json_data.0.http_method").(string),
696701
Interval: d.Get("json_data.0.interval").(string),
702+
Implementation: d.Get("json_data.0.implementation").(string),
697703
LogLevelField: d.Get("json_data.0.log_level_field").(string),
698704
LogMessageField: d.Get("json_data.0.log_message_field").(string),
699705
MaxConcurrentShardRequests: int64(d.Get("json_data.0.max_concurrent_shard_requests").(int)),

0 commit comments

Comments
 (0)