1. Packages
  2. Grafana Cloud
  3. API Docs
  4. DataSource
Grafana v0.7.1 published on Monday, Nov 25, 2024 by pulumiverse

grafana.DataSource

Explore with Pulumi AI

grafana logo
Grafana v0.7.1 published on Monday, Nov 25, 2024 by pulumiverse
    Deprecated: grafana.index/datasource.DataSource has been deprecated in favor of grafana.oss/datasource.DataSource

    The required arguments for this resource vary depending on the type of data source selected (via the ’type’ argument).

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as grafana from "@pulumiverse/grafana";
    
    const arbitrary_data = new grafana.oss.DataSource("arbitrary-data", {
        type: "stackdriver",
        name: "sd-arbitrary-data",
        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.oss.DataSource("influxdb", {
        type: "influxdb",
        name: "myapp-metrics",
        url: "http://influxdb.example.net:8086/",
        basicAuthEnabled: true,
        basicAuthUsername: "username",
        databaseName: "dbname",
        jsonDataEncoded: JSON.stringify({
            authType: "default",
            basicAuthPassword: "mypassword",
        }),
    });
    const cloudwatch = new grafana.oss.DataSource("cloudwatch", {
        type: "cloudwatch",
        name: "cw-example",
        jsonDataEncoded: JSON.stringify({
            defaultRegion: "us-east-1",
            authType: "keys",
        }),
        secureJsonDataEncoded: JSON.stringify({
            accessKey: "123",
            secretKey: "456",
        }),
    });
    const cloudwatchAssumeARN = new grafana.oss.DataSource("cloudwatch_assumeARN", {
        type: "cloudwatch",
        name: "cw-assumeARN-example",
        jsonDataEncoded: JSON.stringify({
            defaultRegion: "us-east-1",
            authType: "grafana_assume_role",
            assumeRoleArn: "arn:aws:iam::123456789012:root",
        }),
    });
    const prometheus = new grafana.oss.DataSource("prometheus", {
        type: "prometheus",
        name: "mimir",
        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 pulumi
    import json
    import pulumiverse_grafana as grafana
    
    arbitrary_data = grafana.oss.DataSource("arbitrary-data",
        type="stackdriver",
        name="sd-arbitrary-data",
        json_data_encoded=json.dumps({
            "tokenUri": "https://oauth2.googleapis.com/token",
            "authenticationType": "jwt",
            "defaultProject": "default-project",
            "clientEmail": "client-email@default-project.iam.gserviceaccount.com",
        }),
        secure_json_data_encoded=json.dumps({
            "privateKey": """-----BEGIN PRIVATE KEY-----
    private-key
    -----END PRIVATE KEY-----
    """,
        }))
    influxdb = grafana.oss.DataSource("influxdb",
        type="influxdb",
        name="myapp-metrics",
        url="http://influxdb.example.net:8086/",
        basic_auth_enabled=True,
        basic_auth_username="username",
        database_name="dbname",
        json_data_encoded=json.dumps({
            "authType": "default",
            "basicAuthPassword": "mypassword",
        }))
    cloudwatch = grafana.oss.DataSource("cloudwatch",
        type="cloudwatch",
        name="cw-example",
        json_data_encoded=json.dumps({
            "defaultRegion": "us-east-1",
            "authType": "keys",
        }),
        secure_json_data_encoded=json.dumps({
            "accessKey": "123",
            "secretKey": "456",
        }))
    cloudwatch_assume_arn = grafana.oss.DataSource("cloudwatch_assumeARN",
        type="cloudwatch",
        name="cw-assumeARN-example",
        json_data_encoded=json.dumps({
            "defaultRegion": "us-east-1",
            "authType": "grafana_assume_role",
            "assumeRoleArn": "arn:aws:iam::123456789012:root",
        }))
    prometheus = grafana.oss.DataSource("prometheus",
        type="prometheus",
        name="mimir",
        url="https://my-instances.com",
        basic_auth_enabled=True,
        basic_auth_username="username",
        json_data_encoded=json.dumps({
            "httpMethod": "POST",
            "prometheusType": "Mimir",
            "prometheusVersion": "2.4.0",
        }),
        secure_json_data_encoded=json.dumps({
            "basicAuthPassword": "password",
        }))
    
    package main
    
    import (
    	"encoding/json"
    
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumiverse/pulumi-grafana/sdk/go/grafana/oss"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		tmpJSON0, err := json.Marshal(map[string]interface{}{
    			"tokenUri":           "https://oauth2.googleapis.com/token",
    			"authenticationType": "jwt",
    			"defaultProject":     "default-project",
    			"clientEmail":        "client-email@default-project.iam.gserviceaccount.com",
    		})
    		if err != nil {
    			return err
    		}
    		json0 := string(tmpJSON0)
    		tmpJSON1, err := json.Marshal(map[string]interface{}{
    			"privateKey": "-----BEGIN PRIVATE KEY-----\nprivate-key\n-----END PRIVATE KEY-----\n",
    		})
    		if err != nil {
    			return err
    		}
    		json1 := string(tmpJSON1)
    		_, err = oss.NewDataSource(ctx, "arbitrary-data", &oss.DataSourceArgs{
    			Type:                  pulumi.String("stackdriver"),
    			Name:                  pulumi.String("sd-arbitrary-data"),
    			JsonDataEncoded:       pulumi.String(json0),
    			SecureJsonDataEncoded: pulumi.String(json1),
    		})
    		if err != nil {
    			return err
    		}
    		tmpJSON2, err := json.Marshal(map[string]interface{}{
    			"authType":          "default",
    			"basicAuthPassword": "mypassword",
    		})
    		if err != nil {
    			return err
    		}
    		json2 := string(tmpJSON2)
    		_, err = oss.NewDataSource(ctx, "influxdb", &oss.DataSourceArgs{
    			Type:              pulumi.String("influxdb"),
    			Name:              pulumi.String("myapp-metrics"),
    			Url:               pulumi.String("http://influxdb.example.net:8086/"),
    			BasicAuthEnabled:  pulumi.Bool(true),
    			BasicAuthUsername: pulumi.String("username"),
    			DatabaseName:      pulumi.String("dbname"),
    			JsonDataEncoded:   pulumi.String(json2),
    		})
    		if err != nil {
    			return err
    		}
    		tmpJSON3, err := json.Marshal(map[string]interface{}{
    			"defaultRegion": "us-east-1",
    			"authType":      "keys",
    		})
    		if err != nil {
    			return err
    		}
    		json3 := string(tmpJSON3)
    		tmpJSON4, err := json.Marshal(map[string]interface{}{
    			"accessKey": "123",
    			"secretKey": "456",
    		})
    		if err != nil {
    			return err
    		}
    		json4 := string(tmpJSON4)
    		_, err = oss.NewDataSource(ctx, "cloudwatch", &oss.DataSourceArgs{
    			Type:                  pulumi.String("cloudwatch"),
    			Name:                  pulumi.String("cw-example"),
    			JsonDataEncoded:       pulumi.String(json3),
    			SecureJsonDataEncoded: pulumi.String(json4),
    		})
    		if err != nil {
    			return err
    		}
    		tmpJSON5, err := json.Marshal(map[string]interface{}{
    			"defaultRegion": "us-east-1",
    			"authType":      "grafana_assume_role",
    			"assumeRoleArn": "arn:aws:iam::123456789012:root",
    		})
    		if err != nil {
    			return err
    		}
    		json5 := string(tmpJSON5)
    		_, err = oss.NewDataSource(ctx, "cloudwatch_assumeARN", &oss.DataSourceArgs{
    			Type:            pulumi.String("cloudwatch"),
    			Name:            pulumi.String("cw-assumeARN-example"),
    			JsonDataEncoded: pulumi.String(json5),
    		})
    		if err != nil {
    			return err
    		}
    		tmpJSON6, err := json.Marshal(map[string]interface{}{
    			"httpMethod":        "POST",
    			"prometheusType":    "Mimir",
    			"prometheusVersion": "2.4.0",
    		})
    		if err != nil {
    			return err
    		}
    		json6 := string(tmpJSON6)
    		tmpJSON7, err := json.Marshal(map[string]interface{}{
    			"basicAuthPassword": "password",
    		})
    		if err != nil {
    			return err
    		}
    		json7 := string(tmpJSON7)
    		_, err = oss.NewDataSource(ctx, "prometheus", &oss.DataSourceArgs{
    			Type:                  pulumi.String("prometheus"),
    			Name:                  pulumi.String("mimir"),
    			Url:                   pulumi.String("https://my-instances.com"),
    			BasicAuthEnabled:      pulumi.Bool(true),
    			BasicAuthUsername:     pulumi.String("username"),
    			JsonDataEncoded:       pulumi.String(json6),
    			SecureJsonDataEncoded: pulumi.String(json7),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using System.Text.Json;
    using Pulumi;
    using Grafana = Pulumiverse.Grafana;
    
    return await Deployment.RunAsync(() => 
    {
        var arbitrary_data = new Grafana.Oss.DataSource("arbitrary-data", new()
        {
            Type = "stackdriver",
            Name = "sd-arbitrary-data",
            JsonDataEncoded = JsonSerializer.Serialize(new Dictionary<string, object?>
            {
                ["tokenUri"] = "https://oauth2.googleapis.com/token",
                ["authenticationType"] = "jwt",
                ["defaultProject"] = "default-project",
                ["clientEmail"] = "client-email@default-project.iam.gserviceaccount.com",
            }),
            SecureJsonDataEncoded = JsonSerializer.Serialize(new Dictionary<string, object?>
            {
                ["privateKey"] = @"-----BEGIN PRIVATE KEY-----
    private-key
    -----END PRIVATE KEY-----
    ",
            }),
        });
    
        var influxdb = new Grafana.Oss.DataSource("influxdb", new()
        {
            Type = "influxdb",
            Name = "myapp-metrics",
            Url = "http://influxdb.example.net:8086/",
            BasicAuthEnabled = true,
            BasicAuthUsername = "username",
            DatabaseName = "dbname",
            JsonDataEncoded = JsonSerializer.Serialize(new Dictionary<string, object?>
            {
                ["authType"] = "default",
                ["basicAuthPassword"] = "mypassword",
            }),
        });
    
        var cloudwatch = new Grafana.Oss.DataSource("cloudwatch", new()
        {
            Type = "cloudwatch",
            Name = "cw-example",
            JsonDataEncoded = JsonSerializer.Serialize(new Dictionary<string, object?>
            {
                ["defaultRegion"] = "us-east-1",
                ["authType"] = "keys",
            }),
            SecureJsonDataEncoded = JsonSerializer.Serialize(new Dictionary<string, object?>
            {
                ["accessKey"] = "123",
                ["secretKey"] = "456",
            }),
        });
    
        var cloudwatchAssumeARN = new Grafana.Oss.DataSource("cloudwatch_assumeARN", new()
        {
            Type = "cloudwatch",
            Name = "cw-assumeARN-example",
            JsonDataEncoded = JsonSerializer.Serialize(new Dictionary<string, object?>
            {
                ["defaultRegion"] = "us-east-1",
                ["authType"] = "grafana_assume_role",
                ["assumeRoleArn"] = "arn:aws:iam::123456789012:root",
            }),
        });
    
        var prometheus = new Grafana.Oss.DataSource("prometheus", new()
        {
            Type = "prometheus",
            Name = "mimir",
            Url = "https://my-instances.com",
            BasicAuthEnabled = true,
            BasicAuthUsername = "username",
            JsonDataEncoded = JsonSerializer.Serialize(new Dictionary<string, object?>
            {
                ["httpMethod"] = "POST",
                ["prometheusType"] = "Mimir",
                ["prometheusVersion"] = "2.4.0",
            }),
            SecureJsonDataEncoded = JsonSerializer.Serialize(new Dictionary<string, object?>
            {
                ["basicAuthPassword"] = "password",
            }),
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.grafana.oss.DataSource;
    import com.pulumi.grafana.oss.DataSourceArgs;
    import static com.pulumi.codegen.internal.Serialization.*;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var arbitrary_data = new DataSource("arbitrary-data", DataSourceArgs.builder()
                .type("stackdriver")
                .name("sd-arbitrary-data")
                .jsonDataEncoded(serializeJson(
                    jsonObject(
                        jsonProperty("tokenUri", "https://oauth2.googleapis.com/token"),
                        jsonProperty("authenticationType", "jwt"),
                        jsonProperty("defaultProject", "default-project"),
                        jsonProperty("clientEmail", "client-email@default-project.iam.gserviceaccount.com")
                    )))
                .secureJsonDataEncoded(serializeJson(
                    jsonObject(
                        jsonProperty("privateKey", """
    -----BEGIN PRIVATE KEY-----
    private-key
    -----END PRIVATE KEY-----
                        """)
                    )))
                .build());
    
            var influxdb = new DataSource("influxdb", DataSourceArgs.builder()
                .type("influxdb")
                .name("myapp-metrics")
                .url("http://influxdb.example.net:8086/")
                .basicAuthEnabled(true)
                .basicAuthUsername("username")
                .databaseName("dbname")
                .jsonDataEncoded(serializeJson(
                    jsonObject(
                        jsonProperty("authType", "default"),
                        jsonProperty("basicAuthPassword", "mypassword")
                    )))
                .build());
    
            var cloudwatch = new DataSource("cloudwatch", DataSourceArgs.builder()
                .type("cloudwatch")
                .name("cw-example")
                .jsonDataEncoded(serializeJson(
                    jsonObject(
                        jsonProperty("defaultRegion", "us-east-1"),
                        jsonProperty("authType", "keys")
                    )))
                .secureJsonDataEncoded(serializeJson(
                    jsonObject(
                        jsonProperty("accessKey", "123"),
                        jsonProperty("secretKey", "456")
                    )))
                .build());
    
            var cloudwatchAssumeARN = new DataSource("cloudwatchAssumeARN", DataSourceArgs.builder()
                .type("cloudwatch")
                .name("cw-assumeARN-example")
                .jsonDataEncoded(serializeJson(
                    jsonObject(
                        jsonProperty("defaultRegion", "us-east-1"),
                        jsonProperty("authType", "grafana_assume_role"),
                        jsonProperty("assumeRoleArn", "arn:aws:iam::123456789012:root")
                    )))
                .build());
    
            var prometheus = new DataSource("prometheus", DataSourceArgs.builder()
                .type("prometheus")
                .name("mimir")
                .url("https://my-instances.com")
                .basicAuthEnabled(true)
                .basicAuthUsername("username")
                .jsonDataEncoded(serializeJson(
                    jsonObject(
                        jsonProperty("httpMethod", "POST"),
                        jsonProperty("prometheusType", "Mimir"),
                        jsonProperty("prometheusVersion", "2.4.0")
                    )))
                .secureJsonDataEncoded(serializeJson(
                    jsonObject(
                        jsonProperty("basicAuthPassword", "password")
                    )))
                .build());
    
        }
    }
    
    resources:
      arbitrary-data:
        type: grafana:oss:DataSource
        properties:
          type: stackdriver
          name: sd-arbitrary-data
          jsonDataEncoded:
            fn::toJSON:
              tokenUri: https://oauth2.googleapis.com/token
              authenticationType: jwt
              defaultProject: default-project
              clientEmail: client-email@default-project.iam.gserviceaccount.com
          secureJsonDataEncoded:
            fn::toJSON:
              privateKey: |
                -----BEGIN PRIVATE KEY-----
                private-key
                -----END PRIVATE KEY-----            
      influxdb:
        type: grafana:oss:DataSource
        properties:
          type: influxdb
          name: myapp-metrics
          url: http://influxdb.example.net:8086/
          basicAuthEnabled: true
          basicAuthUsername: username
          databaseName: dbname
          jsonDataEncoded:
            fn::toJSON:
              authType: default
              basicAuthPassword: mypassword
      cloudwatch:
        type: grafana:oss:DataSource
        properties:
          type: cloudwatch
          name: cw-example
          jsonDataEncoded:
            fn::toJSON:
              defaultRegion: us-east-1
              authType: keys
          secureJsonDataEncoded:
            fn::toJSON:
              accessKey: '123'
              secretKey: '456'
      cloudwatchAssumeARN:
        type: grafana:oss:DataSource
        name: cloudwatch_assumeARN
        properties:
          type: cloudwatch
          name: cw-assumeARN-example
          jsonDataEncoded:
            fn::toJSON:
              defaultRegion: us-east-1
              authType: grafana_assume_role
              assumeRoleArn: arn:aws:iam::123456789012:root
      prometheus:
        type: grafana:oss:DataSource
        properties:
          type: prometheus
          name: mimir
          url: https://my-instances.com
          basicAuthEnabled: true
          basicAuthUsername: username
          jsonDataEncoded:
            fn::toJSON:
              httpMethod: POST
              prometheusType: Mimir
              prometheusVersion: 2.4.0
          secureJsonDataEncoded:
            fn::toJSON:
              basicAuthPassword: password
    

    Create DataSource Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new DataSource(name: string, args: DataSourceArgs, opts?: CustomResourceOptions);
    @overload
    def DataSource(resource_name: str,
                   args: DataSourceArgs,
                   opts: Optional[ResourceOptions] = None)
    
    @overload
    def DataSource(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   access_mode: Optional[str] = None,
                   basic_auth_enabled: Optional[bool] = None,
                   basic_auth_username: Optional[str] = None,
                   database_name: Optional[str] = None,
                   http_headers: Optional[Mapping[str, str]] = None,
                   is_default: Optional[bool] = None,
                   json_data_encoded: Optional[str] = None,
                   name: Optional[str] = None,
                   org_id: Optional[str] = None,
                   secure_json_data_encoded: Optional[str] = None,
                   type: Optional[str] = None,
                   uid: Optional[str] = None,
                   url: Optional[str] = None,
                   username: Optional[str] = None)
    func NewDataSource(ctx *Context, name string, args DataSourceArgs, opts ...ResourceOption) (*DataSource, error)
    public DataSource(string name, DataSourceArgs args, CustomResourceOptions? opts = null)
    public DataSource(String name, DataSourceArgs args)
    public DataSource(String name, DataSourceArgs args, CustomResourceOptions options)
    
    type: grafana:DataSource
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args DataSourceArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args DataSourceArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args DataSourceArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args DataSourceArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args DataSourceArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    DataSource Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The DataSource resource accepts the following input properties:

    Type string
    The data source type. Must be one of the supported data source keywords.
    AccessMode string
    The method by which Grafana will access the data source: proxy or direct. Defaults to proxy.
    BasicAuthEnabled bool
    Whether to enable basic auth for the data source. Defaults to false.
    BasicAuthUsername string
    Basic auth username. Defaults to ``.
    DatabaseName string
    (Required by some data source types) The name of the database to use on the selected data source server. Defaults to ``.
    HttpHeaders Dictionary<string, string>
    Custom HTTP headers
    IsDefault bool
    Whether to set the data source as default. This should only be true to a single data source. Defaults to false.
    JsonDataEncoded string
    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.
    Name string
    A unique name for the data source.
    OrgId string
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    SecureJsonDataEncoded 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.
    Uid string
    Unique identifier. If unset, this will be automatically generated.
    Url string
    The URL for the data source. The type of URL required varies depending on the chosen data source type.
    Username string
    (Required by some data source types) The username to use to authenticate to the data source. Defaults to ``.
    Type string
    The data source type. Must be one of the supported data source keywords.
    AccessMode string
    The method by which Grafana will access the data source: proxy or direct. Defaults to proxy.
    BasicAuthEnabled bool
    Whether to enable basic auth for the data source. Defaults to false.
    BasicAuthUsername string
    Basic auth username. Defaults to ``.
    DatabaseName string
    (Required by some data source types) The name of the database to use on the selected data source server. Defaults to ``.
    HttpHeaders map[string]string
    Custom HTTP headers
    IsDefault bool
    Whether to set the data source as default. This should only be true to a single data source. Defaults to false.
    JsonDataEncoded string
    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.
    Name string
    A unique name for the data source.
    OrgId string
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    SecureJsonDataEncoded 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.
    Uid string
    Unique identifier. If unset, this will be automatically generated.
    Url string
    The URL for the data source. The type of URL required varies depending on the chosen data source type.
    Username string
    (Required by some data source types) The username to use to authenticate to the data source. Defaults to ``.
    type String
    The data source type. Must be one of the supported data source keywords.
    accessMode String
    The method by which Grafana will access the data source: proxy or direct. Defaults to proxy.
    basicAuthEnabled Boolean
    Whether to enable basic auth for the data source. Defaults to false.
    basicAuthUsername String
    Basic auth username. Defaults to ``.
    databaseName String
    (Required by some data source types) The name of the database to use on the selected data source server. Defaults to ``.
    httpHeaders Map<String,String>
    Custom HTTP headers
    isDefault Boolean
    Whether to set the data source as default. This should only be true to a single data source. Defaults to false.
    jsonDataEncoded String
    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.
    name String
    A unique name for the data source.
    orgId String
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    secureJsonDataEncoded 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.
    uid String
    Unique identifier. If unset, this will be automatically generated.
    url String
    The URL for the data source. The type of URL required varies depending on the chosen data source type.
    username String
    (Required by some data source types) The username to use to authenticate to the data source. Defaults to ``.
    type string
    The data source type. Must be one of the supported data source keywords.
    accessMode string
    The method by which Grafana will access the data source: proxy or direct. Defaults to proxy.
    basicAuthEnabled boolean
    Whether to enable basic auth for the data source. Defaults to false.
    basicAuthUsername string
    Basic auth username. Defaults to ``.
    databaseName string
    (Required by some data source types) The name of the database to use on the selected data source server. Defaults to ``.
    httpHeaders {[key: string]: string}
    Custom HTTP headers
    isDefault boolean
    Whether to set the data source as default. This should only be true to a single data source. Defaults to false.
    jsonDataEncoded string
    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.
    name string
    A unique name for the data source.
    orgId string
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    secureJsonDataEncoded 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.
    uid string
    Unique identifier. If unset, this will be automatically generated.
    url string
    The URL for the data source. The type of URL required varies depending on the chosen data source type.
    username string
    (Required by some data source types) The username to use to authenticate to the data source. Defaults to ``.
    type str
    The data source type. Must be one of the supported data source keywords.
    access_mode str
    The method by which Grafana will access the data source: proxy or direct. Defaults to proxy.
    basic_auth_enabled bool
    Whether to enable basic auth for the data source. Defaults to false.
    basic_auth_username str
    Basic auth username. Defaults to ``.
    database_name str
    (Required by some data source types) The name of the database to use on the selected data source server. Defaults to ``.
    http_headers Mapping[str, str]
    Custom HTTP headers
    is_default bool
    Whether to set the data source as default. This should only be true to a single data source. Defaults to false.
    json_data_encoded str
    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.
    name str
    A unique name for the data source.
    org_id str
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    secure_json_data_encoded str
    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.
    uid str
    Unique identifier. If unset, this will be automatically generated.
    url str
    The URL for the data source. The type of URL required varies depending on the chosen data source type.
    username str
    (Required by some data source types) The username to use to authenticate to the data source. Defaults to ``.
    type String
    The data source type. Must be one of the supported data source keywords.
    accessMode String
    The method by which Grafana will access the data source: proxy or direct. Defaults to proxy.
    basicAuthEnabled Boolean
    Whether to enable basic auth for the data source. Defaults to false.
    basicAuthUsername String
    Basic auth username. Defaults to ``.
    databaseName String
    (Required by some data source types) The name of the database to use on the selected data source server. Defaults to ``.
    httpHeaders Map<String>
    Custom HTTP headers
    isDefault Boolean
    Whether to set the data source as default. This should only be true to a single data source. Defaults to false.
    jsonDataEncoded String
    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.
    name String
    A unique name for the data source.
    orgId String
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    secureJsonDataEncoded 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.
    uid String
    Unique identifier. If unset, this will be automatically generated.
    url String
    The URL for the data source. The type of URL required varies depending on the chosen data source type.
    username String
    (Required by some data source types) The username to use to authenticate to the data source. Defaults to ``.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the DataSource resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing DataSource Resource

    Get an existing DataSource resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: DataSourceState, opts?: CustomResourceOptions): DataSource
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            access_mode: Optional[str] = None,
            basic_auth_enabled: Optional[bool] = None,
            basic_auth_username: Optional[str] = None,
            database_name: Optional[str] = None,
            http_headers: Optional[Mapping[str, str]] = None,
            is_default: Optional[bool] = None,
            json_data_encoded: Optional[str] = None,
            name: Optional[str] = None,
            org_id: Optional[str] = None,
            secure_json_data_encoded: Optional[str] = None,
            type: Optional[str] = None,
            uid: Optional[str] = None,
            url: Optional[str] = None,
            username: Optional[str] = None) -> DataSource
    func GetDataSource(ctx *Context, name string, id IDInput, state *DataSourceState, opts ...ResourceOption) (*DataSource, error)
    public static DataSource Get(string name, Input<string> id, DataSourceState? state, CustomResourceOptions? opts = null)
    public static DataSource get(String name, Output<String> id, DataSourceState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    AccessMode string
    The method by which Grafana will access the data source: proxy or direct. Defaults to proxy.
    BasicAuthEnabled bool
    Whether to enable basic auth for the data source. Defaults to false.
    BasicAuthUsername string
    Basic auth username. Defaults to ``.
    DatabaseName string
    (Required by some data source types) The name of the database to use on the selected data source server. Defaults to ``.
    HttpHeaders Dictionary<string, string>
    Custom HTTP headers
    IsDefault bool
    Whether to set the data source as default. This should only be true to a single data source. Defaults to false.
    JsonDataEncoded string
    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.
    Name string
    A unique name for the data source.
    OrgId string
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    SecureJsonDataEncoded 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.
    Type string
    The data source type. Must be one of the supported data source keywords.
    Uid string
    Unique identifier. If unset, this will be automatically generated.
    Url string
    The URL for the data source. The type of URL required varies depending on the chosen data source type.
    Username string
    (Required by some data source types) The username to use to authenticate to the data source. Defaults to ``.
    AccessMode string
    The method by which Grafana will access the data source: proxy or direct. Defaults to proxy.
    BasicAuthEnabled bool
    Whether to enable basic auth for the data source. Defaults to false.
    BasicAuthUsername string
    Basic auth username. Defaults to ``.
    DatabaseName string
    (Required by some data source types) The name of the database to use on the selected data source server. Defaults to ``.
    HttpHeaders map[string]string
    Custom HTTP headers
    IsDefault bool
    Whether to set the data source as default. This should only be true to a single data source. Defaults to false.
    JsonDataEncoded string
    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.
    Name string
    A unique name for the data source.
    OrgId string
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    SecureJsonDataEncoded 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.
    Type string
    The data source type. Must be one of the supported data source keywords.
    Uid string
    Unique identifier. If unset, this will be automatically generated.
    Url string
    The URL for the data source. The type of URL required varies depending on the chosen data source type.
    Username string
    (Required by some data source types) The username to use to authenticate to the data source. Defaults to ``.
    accessMode String
    The method by which Grafana will access the data source: proxy or direct. Defaults to proxy.
    basicAuthEnabled Boolean
    Whether to enable basic auth for the data source. Defaults to false.
    basicAuthUsername String
    Basic auth username. Defaults to ``.
    databaseName String
    (Required by some data source types) The name of the database to use on the selected data source server. Defaults to ``.
    httpHeaders Map<String,String>
    Custom HTTP headers
    isDefault Boolean
    Whether to set the data source as default. This should only be true to a single data source. Defaults to false.
    jsonDataEncoded String
    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.
    name String
    A unique name for the data source.
    orgId String
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    secureJsonDataEncoded 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.
    type String
    The data source type. Must be one of the supported data source keywords.
    uid String
    Unique identifier. If unset, this will be automatically generated.
    url String
    The URL for the data source. The type of URL required varies depending on the chosen data source type.
    username String
    (Required by some data source types) The username to use to authenticate to the data source. Defaults to ``.
    accessMode string
    The method by which Grafana will access the data source: proxy or direct. Defaults to proxy.
    basicAuthEnabled boolean
    Whether to enable basic auth for the data source. Defaults to false.
    basicAuthUsername string
    Basic auth username. Defaults to ``.
    databaseName string
    (Required by some data source types) The name of the database to use on the selected data source server. Defaults to ``.
    httpHeaders {[key: string]: string}
    Custom HTTP headers
    isDefault boolean
    Whether to set the data source as default. This should only be true to a single data source. Defaults to false.
    jsonDataEncoded string
    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.
    name string
    A unique name for the data source.
    orgId string
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    secureJsonDataEncoded 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.
    type string
    The data source type. Must be one of the supported data source keywords.
    uid string
    Unique identifier. If unset, this will be automatically generated.
    url string
    The URL for the data source. The type of URL required varies depending on the chosen data source type.
    username string
    (Required by some data source types) The username to use to authenticate to the data source. Defaults to ``.
    access_mode str
    The method by which Grafana will access the data source: proxy or direct. Defaults to proxy.
    basic_auth_enabled bool
    Whether to enable basic auth for the data source. Defaults to false.
    basic_auth_username str
    Basic auth username. Defaults to ``.
    database_name str
    (Required by some data source types) The name of the database to use on the selected data source server. Defaults to ``.
    http_headers Mapping[str, str]
    Custom HTTP headers
    is_default bool
    Whether to set the data source as default. This should only be true to a single data source. Defaults to false.
    json_data_encoded str
    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.
    name str
    A unique name for the data source.
    org_id str
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    secure_json_data_encoded str
    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.
    type str
    The data source type. Must be one of the supported data source keywords.
    uid str
    Unique identifier. If unset, this will be automatically generated.
    url str
    The URL for the data source. The type of URL required varies depending on the chosen data source type.
    username str
    (Required by some data source types) The username to use to authenticate to the data source. Defaults to ``.
    accessMode String
    The method by which Grafana will access the data source: proxy or direct. Defaults to proxy.
    basicAuthEnabled Boolean
    Whether to enable basic auth for the data source. Defaults to false.
    basicAuthUsername String
    Basic auth username. Defaults to ``.
    databaseName String
    (Required by some data source types) The name of the database to use on the selected data source server. Defaults to ``.
    httpHeaders Map<String>
    Custom HTTP headers
    isDefault Boolean
    Whether to set the data source as default. This should only be true to a single data source. Defaults to false.
    jsonDataEncoded String
    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.
    name String
    A unique name for the data source.
    orgId String
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    secureJsonDataEncoded 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.
    type String
    The data source type. Must be one of the supported data source keywords.
    uid String
    Unique identifier. If unset, this will be automatically generated.
    url String
    The URL for the data source. The type of URL required varies depending on the chosen data source type.
    username String
    (Required by some data source types) The username to use to authenticate to the data source. Defaults to ``.

    Import

    $ pulumi import grafana:index/dataSource:DataSource name "{{ uid }}"
    
    $ pulumi import grafana:index/dataSource:DataSource name "{{ orgID }}:{{ uid }}"
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    grafana pulumiverse/pulumi-grafana
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the grafana Terraform Provider.
    grafana logo
    Grafana v0.7.1 published on Monday, Nov 25, 2024 by pulumiverse