@lbrlabs/pulumi-grafana
Version:
A Pulumi package for creating and managing grafana.
295 lines (294 loc) • 12.1 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
/**
* * [Official documentation](https://grafana.com/docs/grafana/latest/datasources/)
* * [HTTP API](https://grafana.com/docs/grafana/latest/developers/http_api/data_source/)
*
* The required arguments for this resource vary depending on the type of data
* source selected (via the 'type' argument).
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as grafana from "@lbrlabs/pulumi-grafana";
*
* const arbitrary_data = new grafana.DataSource("arbitrary-data", {
* type: "stackdriver",
* jsonDataEncoded: JSON.stringify({
* tokenUri: "https://oauth2.googleapis.com/token",
* authenticationType: "jwt",
* defaultProject: "default-project",
* clientEmail: "client-email@default-project.iam.gserviceaccount.com",
* }),
* secureJsonDataEncoded: JSON.stringify({
* privateKey: `-----BEGIN PRIVATE KEY-----
* private-key
* -----END PRIVATE KEY-----
* `,
* }),
* });
* const influxdb = new grafana.DataSource("influxdb", {
* type: "influxdb",
* url: "http://influxdb.example.net:8086/",
* basicAuthEnabled: true,
* basicAuthUsername: "username",
* databaseName: influxdb_database.metrics.name,
* jsonDataEncoded: JSON.stringify({
* authType: "default",
* basicAuthPassword: "mypassword",
* }),
* });
* const cloudwatch = new grafana.DataSource("cloudwatch", {
* type: "cloudwatch",
* jsonDataEncoded: JSON.stringify({
* defaultRegion: "us-east-1",
* authType: "keys",
* }),
* secureJsonDataEncoded: JSON.stringify({
* accessKey: "123",
* secretKey: "456",
* }),
* });
* const prometheus = new grafana.DataSource("prometheus", {
* type: "prometheus",
* url: "https://my-instances.com",
* basicAuthEnabled: true,
* basicAuthUsername: "username",
* jsonDataEncoded: JSON.stringify({
* httpMethod: "POST",
* prometheusType: "Mimir",
* prometheusVersion: "2.4.0",
* }),
* secureJsonDataEncoded: JSON.stringify({
* basicAuthPassword: "password",
* }),
* });
* ```
*
* ## Import
*
* ```sh
* $ pulumi import grafana:index/dataSource:DataSource by_integer_id {{datasource_id}} # To use the default provider org
* ```
*
* ```sh
* $ pulumi import grafana:index/dataSource:DataSource by_uid {{datasource_uid}} # To use the default provider org
* ```
*
* ```sh
* $ pulumi import grafana:index/dataSource:DataSource by_integer_id {{org_id}}:{{datasource_id}} # When "org_id" is set on the resource
* ```
*
* ```sh
* $ pulumi import grafana:index/dataSource:DataSource by_uid {{org_id}}:{{datasource_uid}} # When "org_id" is set on the resource
* ```
*/
export declare class DataSource extends pulumi.CustomResource {
/**
* Get an existing DataSource resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state Any extra arguments used during the lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
static get(name: string, id: pulumi.Input<pulumi.ID>, state?: DataSourceState, opts?: pulumi.CustomResourceOptions): DataSource;
/**
* Returns true if the given object is an instance of DataSource. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj: any): obj is DataSource;
/**
* The method by which Grafana will access the data source: `proxy` or `direct`. Defaults to `proxy`.
*/
readonly accessMode: pulumi.Output<string | undefined>;
/**
* Whether to enable basic auth for the data source. Defaults to `false`.
*/
readonly basicAuthEnabled: pulumi.Output<boolean | undefined>;
/**
* Basic auth username. Defaults to ``.
*/
readonly basicAuthUsername: pulumi.Output<string | undefined>;
/**
* (Required by some data source types) The name of the database to use on the selected data source server. Defaults to ``.
*/
readonly databaseName: pulumi.Output<string | undefined>;
/**
* Custom HTTP headers
*/
readonly httpHeaders: pulumi.Output<{
[key: string]: string;
} | undefined>;
/**
* Whether to set the data source as default. This should only be `true` to a single data source. Defaults to `false`.
*/
readonly isDefault: pulumi.Output<boolean | undefined>;
/**
* Serialized JSON string containing the json data. This attribute can be used to pass configuration options to the data source. To figure out what options a datasource has available, see its docs or inspect the network data when saving it from the Grafana UI. Note that keys in this map are usually camelCased.
*/
readonly jsonDataEncoded: pulumi.Output<string | undefined>;
/**
* A unique name for the data source.
*/
readonly name: pulumi.Output<string>;
/**
* The Organization ID. If not set, the Org ID defined in the provider block will be used.
*/
readonly orgId: pulumi.Output<string | undefined>;
/**
* Serialized JSON string containing the secure json data. This attribute can be used to pass secure configuration options to the data source. To figure out what options a datasource has available, see its docs or inspect the network data when saving it from the Grafana UI. Note that keys in this map are usually camelCased.
*/
readonly secureJsonDataEncoded: pulumi.Output<string | undefined>;
/**
* The data source type. Must be one of the supported data source keywords.
*/
readonly type: pulumi.Output<string>;
/**
* Unique identifier. If unset, this will be automatically generated.
*/
readonly uid: pulumi.Output<string>;
/**
* The URL for the data source. The type of URL required varies depending on the chosen data source type.
*/
readonly url: pulumi.Output<string | undefined>;
/**
* (Required by some data source types) The username to use to authenticate to the data source. Defaults to ``.
*/
readonly username: pulumi.Output<string | undefined>;
/**
* Create a DataSource resource with the given unique name, arguments, and options.
*
* @param name The _unique_ name of the resource.
* @param args The arguments to use to populate this resource's properties.
* @param opts A bag of options that control this resource's behavior.
*/
constructor(name: string, args: DataSourceArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering DataSource resources.
*/
export interface DataSourceState {
/**
* The method by which Grafana will access the data source: `proxy` or `direct`. Defaults to `proxy`.
*/
accessMode?: pulumi.Input<string>;
/**
* Whether to enable basic auth for the data source. Defaults to `false`.
*/
basicAuthEnabled?: pulumi.Input<boolean>;
/**
* Basic auth username. Defaults to ``.
*/
basicAuthUsername?: pulumi.Input<string>;
/**
* (Required by some data source types) The name of the database to use on the selected data source server. Defaults to ``.
*/
databaseName?: pulumi.Input<string>;
/**
* Custom HTTP headers
*/
httpHeaders?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
}>;
/**
* Whether to set the data source as default. This should only be `true` to a single data source. Defaults to `false`.
*/
isDefault?: pulumi.Input<boolean>;
/**
* Serialized JSON string containing the json data. This attribute can be used to pass configuration options to the data source. To figure out what options a datasource has available, see its docs or inspect the network data when saving it from the Grafana UI. Note that keys in this map are usually camelCased.
*/
jsonDataEncoded?: pulumi.Input<string>;
/**
* A unique name for the data source.
*/
name?: pulumi.Input<string>;
/**
* The Organization ID. If not set, the Org ID defined in the provider block will be used.
*/
orgId?: pulumi.Input<string>;
/**
* Serialized JSON string containing the secure json data. This attribute can be used to pass secure configuration options to the data source. To figure out what options a datasource has available, see its docs or inspect the network data when saving it from the Grafana UI. Note that keys in this map are usually camelCased.
*/
secureJsonDataEncoded?: pulumi.Input<string>;
/**
* The data source type. Must be one of the supported data source keywords.
*/
type?: pulumi.Input<string>;
/**
* Unique identifier. If unset, this will be automatically generated.
*/
uid?: pulumi.Input<string>;
/**
* The URL for the data source. The type of URL required varies depending on the chosen data source type.
*/
url?: pulumi.Input<string>;
/**
* (Required by some data source types) The username to use to authenticate to the data source. Defaults to ``.
*/
username?: pulumi.Input<string>;
}
/**
* The set of arguments for constructing a DataSource resource.
*/
export interface DataSourceArgs {
/**
* The method by which Grafana will access the data source: `proxy` or `direct`. Defaults to `proxy`.
*/
accessMode?: pulumi.Input<string>;
/**
* Whether to enable basic auth for the data source. Defaults to `false`.
*/
basicAuthEnabled?: pulumi.Input<boolean>;
/**
* Basic auth username. Defaults to ``.
*/
basicAuthUsername?: pulumi.Input<string>;
/**
* (Required by some data source types) The name of the database to use on the selected data source server. Defaults to ``.
*/
databaseName?: pulumi.Input<string>;
/**
* Custom HTTP headers
*/
httpHeaders?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
}>;
/**
* Whether to set the data source as default. This should only be `true` to a single data source. Defaults to `false`.
*/
isDefault?: pulumi.Input<boolean>;
/**
* Serialized JSON string containing the json data. This attribute can be used to pass configuration options to the data source. To figure out what options a datasource has available, see its docs or inspect the network data when saving it from the Grafana UI. Note that keys in this map are usually camelCased.
*/
jsonDataEncoded?: pulumi.Input<string>;
/**
* A unique name for the data source.
*/
name?: pulumi.Input<string>;
/**
* The Organization ID. If not set, the Org ID defined in the provider block will be used.
*/
orgId?: pulumi.Input<string>;
/**
* Serialized JSON string containing the secure json data. This attribute can be used to pass secure configuration options to the data source. To figure out what options a datasource has available, see its docs or inspect the network data when saving it from the Grafana UI. Note that keys in this map are usually camelCased.
*/
secureJsonDataEncoded?: pulumi.Input<string>;
/**
* The data source type. Must be one of the supported data source keywords.
*/
type: pulumi.Input<string>;
/**
* Unique identifier. If unset, this will be automatically generated.
*/
uid?: pulumi.Input<string>;
/**
* The URL for the data source. The type of URL required varies depending on the chosen data source type.
*/
url?: pulumi.Input<string>;
/**
* (Required by some data source types) The username to use to authenticate to the data source. Defaults to ``.
*/
username?: pulumi.Input<string>;
}