|
| 1 | +--- |
| 2 | +# generated by https://github.com/hashicorp/terraform-plugin-docs |
| 3 | +page_title: "grafana_data_source Resource - terraform-provider-grafana" |
| 4 | +subcategory: "" |
| 5 | +description: |- |
| 6 | + Official documentation https://grafana.com/docs/grafana/latest/datasources/HTTP API https://grafana.com/docs/grafana/latest/http_api/data_source/ |
| 7 | + The required arguments for this resource vary depending on the type of data |
| 8 | + source selected (via the 'type' argument). |
| 9 | +--- |
| 10 | + |
| 11 | +# grafana_data_source (Resource) |
| 12 | + |
| 13 | +* [Official documentation](https://grafana.com/docs/grafana/latest/datasources/) |
| 14 | +* [HTTP API](https://grafana.com/docs/grafana/latest/http_api/data_source/) |
| 15 | + |
| 16 | +The required arguments for this resource vary depending on the type of data |
| 17 | +source selected (via the 'type' argument). |
| 18 | + |
| 19 | +## Example Usage |
| 20 | + |
| 21 | +```terraform |
| 22 | +resource "grafana_data_source" "influxdb" { |
| 23 | + type = "influxdb" |
| 24 | + name = "myapp-metrics" |
| 25 | + url = "http://influxdb.example.net:8086/" |
| 26 | + username = "myapp" |
| 27 | + password = "foobarbaz" |
| 28 | + database_name = influxdb_database.metrics.name |
| 29 | +} |
| 30 | +
|
| 31 | +resource "grafana_data_source" "cloudwatch" { |
| 32 | + type = "cloudwatch" |
| 33 | + name = "cw-example" |
| 34 | +
|
| 35 | + json_data { |
| 36 | + default_region = "us-east-1" |
| 37 | + auth_type = "keys" |
| 38 | + } |
| 39 | +
|
| 40 | + secure_json_data { |
| 41 | + access_key = "123" |
| 42 | + secret_key = "456" |
| 43 | + } |
| 44 | +} |
| 45 | +
|
| 46 | +resource "grafana_data_source" "stackdriver" { |
| 47 | + type = "stackdriver" |
| 48 | + name = "sd-example" |
| 49 | +
|
| 50 | + json_data { |
| 51 | + token_uri = "https://oauth2.googleapis.com/token" |
| 52 | + authentication_type = "jwt" |
| 53 | + default_project = "default-project" |
| 54 | + client_email = "client-email@default-project.iam.gserviceaccount.com" |
| 55 | + } |
| 56 | +
|
| 57 | + secure_json_data { |
| 58 | + private_key = "-----BEGIN PRIVATE KEY-----\nprivate-key\n-----END PRIVATE KEY-----\n" |
| 59 | + } |
| 60 | +} |
| 61 | +``` |
| 62 | + |
| 63 | +<!-- schema generated by tfplugindocs --> |
| 64 | +## Schema |
| 65 | + |
| 66 | +### Required |
| 67 | + |
| 68 | +- **name** (String) A unique name for the data source. |
| 69 | +- **type** (String) The data source type. Must be one of the supported data source keywords. |
| 70 | + |
| 71 | +### Optional |
| 72 | + |
| 73 | +- **access_mode** (String) The method by which Grafana will access the data source: `proxy` or `direct`. Defaults to `proxy`. |
| 74 | +- **basic_auth_enabled** (Boolean) Whether to enable basic auth for the data source. Defaults to `false`. |
| 75 | +- **basic_auth_password** (String, Sensitive) Basic auth password. Defaults to ``. |
| 76 | +- **basic_auth_username** (String) Basic auth username. Defaults to ``. |
| 77 | +- **database_name** (String) (Required by some data source types) The name of the database to use on the selected data source server. Defaults to ``. |
| 78 | +- **id** (String) The ID of this resource. |
| 79 | +- **is_default** (Boolean) Whether to set the data source as default. This should only be `true` to a single data source. Defaults to `false`. |
| 80 | +- **json_data** (Block List) (Required by some data source types) (see [below for nested schema](#nestedblock--json_data)) |
| 81 | +- **password** (String, Sensitive) (Required by some data source types) The password to use to authenticate to the data source. Defaults to ``. |
| 82 | +- **secure_json_data** (Block List) (see [below for nested schema](#nestedblock--secure_json_data)) |
| 83 | +- **url** (String) The URL for the data source. The type of URL required varies depending on the chosen data source type. |
| 84 | +- **username** (String) (Required by some data source types) The username to use to authenticate to the data source. Defaults to ``. |
| 85 | + |
| 86 | +<a id="nestedblock--json_data"></a> |
| 87 | +### Nested Schema for `json_data` |
| 88 | + |
| 89 | +Optional: |
| 90 | + |
| 91 | +- **assume_role_arn** (String) (CloudWatch) The ARN of the role to be assumed by Grafana when using the CloudWatch data source. |
| 92 | +- **auth_type** (String) (CloudWatch) The authentication type used to access the data source. |
| 93 | +- **authentication_type** (String) (Stackdriver) The authentication type: `jwt` or `gce`. |
| 94 | +- **client_email** (String) (Stackdriver) Service account email address. |
| 95 | +- **conn_max_lifetime** (Number) (MySQL, PostgreSQL, and MSSQL) Maximum amount of time in seconds a connection may be reused (Grafana v5.4+). |
| 96 | +- **custom_metrics_namespaces** (String) (CloudWatch) A comma-separated list of custom namespaces to be queried by the CloudWatch data source. |
| 97 | +- **default_project** (String) (Stackdriver) The default project for the data source. |
| 98 | +- **default_region** (String) (CloudWatch) The default region for the data source. |
| 99 | +- **encrypt** (String) (MSSQL) Connection SSL encryption handling: 'disable', 'false' or 'true'. |
| 100 | +- **es_version** (Number) (Elasticsearch) Elasticsearch version as a number (2/5/56/60/70). |
| 101 | +- **graphite_version** (String) (Graphite) Graphite version. |
| 102 | +- **http_method** (String) (Prometheus) HTTP method to use for making requests. |
| 103 | +- **interval** (String) (Elasticsearch) Index date time format. nil(No Pattern), 'Hourly', 'Daily', 'Weekly', 'Monthly' or 'Yearly'. |
| 104 | +- **log_level_field** (String) (Elasticsearch) Which field should be used to indicate the priority of the log message. |
| 105 | +- **log_message_field** (String) (Elasticsearch) Which field should be used as the log message. |
| 106 | +- **max_idle_conns** (Number) (MySQL, PostgreSQL and MSSQL) Maximum number of connections in the idle connection pool (Grafana v5.4+). |
| 107 | +- **max_open_conns** (Number) (MySQL, PostgreSQL and MSSQL) Maximum number of open connections to the database (Grafana v5.4+). |
| 108 | +- **postgres_version** (Number) (PostgreSQL) Postgres version as a number (903/904/905/906/1000) meaning v9.3, v9.4, etc. |
| 109 | +- **profile** (String) (CloudWatch) The credentials profile name to use when authentication type is set as 'Credentials file'. |
| 110 | +- **query_timeout** (String) (Prometheus) Timeout for queries made to the Prometheus data source in seconds. |
| 111 | +- **ssl_mode** (String) (PostgreSQL) SSLmode. 'disable', 'require', 'verify-ca' or 'verify-full'. |
| 112 | +- **time_field** (String) (Elasticsearch) Which field that should be used as timestamp. |
| 113 | +- **time_interval** (String) (Prometheus, Elasticsearch, InfluxDB, MySQL, PostgreSQL, and MSSQL) Lowest interval/step value that should be used for this data source. |
| 114 | +- **timescaledb** (Boolean) (PostgreSQL) Enable usage of TimescaleDB extension. |
| 115 | +- **tls_auth** (Boolean) (All) Enable TLS authentication using client cert configured in secure json data. |
| 116 | +- **tls_auth_with_ca_cert** (Boolean) (All) Enable TLS authentication using CA cert. |
| 117 | +- **tls_skip_verify** (Boolean) (All) Controls whether a client verifies the server’s certificate chain and host name. |
| 118 | +- **token_uri** (String) (Stackdriver) The token URI used, provided in the service account key. |
| 119 | +- **tsdb_resolution** (String) (OpenTSDB) Resolution. |
| 120 | +- **tsdb_version** (String) (OpenTSDB) Version. |
| 121 | + |
| 122 | + |
| 123 | +<a id="nestedblock--secure_json_data"></a> |
| 124 | +### Nested Schema for `secure_json_data` |
| 125 | + |
| 126 | +Optional: |
| 127 | + |
| 128 | +- **access_key** (String, Sensitive) (CloudWatch) The access key to use to access the data source. |
| 129 | +- **basic_auth_password** (String, Sensitive) (All) Password to use for basic authentication. |
| 130 | +- **password** (String, Sensitive) (All) Password to use for authentication. |
| 131 | +- **private_key** (String, Sensitive) (Stackdriver) The service account key `private_key` to use to access the data source. |
| 132 | +- **secret_key** (String, Sensitive) (CloudWatch) The secret key to use to access the data source. |
| 133 | +- **tls_ca_cert** (String, Sensitive) (All) CA cert for out going requests. |
| 134 | +- **tls_client_cert** (String, Sensitive) (All) TLS Client cert for outgoing requests. |
| 135 | +- **tls_client_key** (String, Sensitive) (All) TLS Client key for outgoing requests. |
| 136 | + |
| 137 | + |
0 commit comments