1. Packages
  2. Grafana Cloud
  3. API Docs
  4. DataSource
Grafana v0.5.1 published on Wednesday, Jun 12, 2024 by pulumiverse

grafana.DataSource

Explore with Pulumi AI

grafana logo
Grafana v0.5.1 published on Wednesday, Jun 12, 2024 by pulumiverse

    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.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: "dbname",
        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 pulumi
    import json
    import pulumiverse_grafana as grafana
    
    arbitrary_data = grafana.DataSource("arbitrary-data",
        type="stackdriver",
        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.DataSource("influxdb",
        type="influxdb",
        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.DataSource("cloudwatch",
        type="cloudwatch",
        json_data_encoded=json.dumps({
            "defaultRegion": "us-east-1",
            "authType": "keys",
        }),
        secure_json_data_encoded=json.dumps({
            "accessKey": "123",
            "secretKey": "456",
        }))
    prometheus = grafana.DataSource("prometheus",
        type="prometheus",
        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"
    )
    
    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 = grafana.NewDataSource(ctx, "arbitrary-data", &grafana.DataSourceArgs{
    			Type:                  pulumi.String("stackdriver"),
    			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 = grafana.NewDataSource(ctx, "influxdb", &grafana.DataSourceArgs{
    			Type:              pulumi.String("influxdb"),
    			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 = grafana.NewDataSource(ctx, "cloudwatch", &grafana.DataSourceArgs{
    			Type:                  pulumi.String("cloudwatch"),
    			JsonDataEncoded:       pulumi.String(json3),
    			SecureJsonDataEncoded: pulumi.String(json4),
    		})
    		if err != nil {
    			return err
    		}
    		tmpJSON5, err := json.Marshal(map[string]interface{}{
    			"httpMethod":        "POST",
    			"prometheusType":    "Mimir",
    			"prometheusVersion": "2.4.0",
    		})
    		if err != nil {
    			return err
    		}
    		json5 := string(tmpJSON5)
    		tmpJSON6, err := json.Marshal(map[string]interface{}{
    			"basicAuthPassword": "password",
    		})
    		if err != nil {
    			return err
    		}
    		json6 := string(tmpJSON6)
    		_, err = grafana.NewDataSource(ctx, "prometheus", &grafana.DataSourceArgs{
    			Type:                  pulumi.String("prometheus"),
    			Url:                   pulumi.String("https://my-instances.com"),
    			BasicAuthEnabled:      pulumi.Bool(true),
    			BasicAuthUsername:     pulumi.String("username"),
    			JsonDataEncoded:       pulumi.String(json5),
    			SecureJsonDataEncoded: pulumi.String(json6),
    		})
    		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.DataSource("arbitrary-data", new()
        {
            Type = "stackdriver",
            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.DataSource("influxdb", new()
        {
            Type = "influxdb",
            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.DataSource("cloudwatch", new()
        {
            Type = "cloudwatch",
            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 prometheus = new Grafana.DataSource("prometheus", new()
        {
            Type = "prometheus",
            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.DataSource;
    import com.pulumi.grafana.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")
                .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")
                .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")
                .jsonDataEncoded(serializeJson(
                    jsonObject(
                        jsonProperty("defaultRegion", "us-east-1"),
                        jsonProperty("authType", "keys")
                    )))
                .secureJsonDataEncoded(serializeJson(
                    jsonObject(
                        jsonProperty("accessKey", "123"),
                        jsonProperty("secretKey", "456")
                    )))
                .build());
    
            var prometheus = new DataSource("prometheus", DataSourceArgs.builder()        
                .type("prometheus")
                .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:DataSource
        properties:
          type: stackdriver
          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:DataSource
        properties:
          type: influxdb
          url: http://influxdb.example.net:8086/
          basicAuthEnabled: true
          basicAuthUsername: username
          databaseName: dbname # Example: influxdb_database.metrics.name
          jsonDataEncoded:
            fn::toJSON:
              authType: default
              basicAuthPassword: mypassword
      cloudwatch:
        type: grafana:DataSource
        properties:
          type: cloudwatch
          jsonDataEncoded:
            fn::toJSON:
              defaultRegion: us-east-1
              authType: keys
          secureJsonDataEncoded:
            fn::toJSON:
              accessKey: '123'
              secretKey: '456'
      prometheus:
        type: grafana:DataSource
        properties:
          type: prometheus
          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,
                   type: Optional[str] = None,
                   json_data_encoded: Optional[str] = None,
                   basic_auth_username: Optional[str] = None,
                   database_name: Optional[str] = None,
                   http_headers: Optional[Mapping[str, str]] = None,
                   is_default: Optional[bool] = None,
                   access_mode: Optional[str] = None,
                   name: Optional[str] = None,
                   org_id: Optional[str] = None,
                   secure_json_data_encoded: Optional[str] = None,
                   basic_auth_enabled: Optional[bool] = 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.

    Example

    The following reference example uses placeholder values for all input properties.

    var dataSourceResource = new Grafana.DataSource("dataSourceResource", new()
    {
        Type = "string",
        JsonDataEncoded = "string",
        BasicAuthUsername = "string",
        DatabaseName = "string",
        HttpHeaders = 
        {
            { "string", "string" },
        },
        IsDefault = false,
        AccessMode = "string",
        Name = "string",
        OrgId = "string",
        SecureJsonDataEncoded = "string",
        BasicAuthEnabled = false,
        Uid = "string",
        Url = "string",
        Username = "string",
    });
    
    example, err := grafana.NewDataSource(ctx, "dataSourceResource", &grafana.DataSourceArgs{
    	Type:              pulumi.String("string"),
    	JsonDataEncoded:   pulumi.String("string"),
    	BasicAuthUsername: pulumi.String("string"),
    	DatabaseName:      pulumi.String("string"),
    	HttpHeaders: pulumi.StringMap{
    		"string": pulumi.String("string"),
    	},
    	IsDefault:             pulumi.Bool(false),
    	AccessMode:            pulumi.String("string"),
    	Name:                  pulumi.String("string"),
    	OrgId:                 pulumi.String("string"),
    	SecureJsonDataEncoded: pulumi.String("string"),
    	BasicAuthEnabled:      pulumi.Bool(false),
    	Uid:                   pulumi.String("string"),
    	Url:                   pulumi.String("string"),
    	Username:              pulumi.String("string"),
    })
    
    var dataSourceResource = new DataSource("dataSourceResource", DataSourceArgs.builder()
        .type("string")
        .jsonDataEncoded("string")
        .basicAuthUsername("string")
        .databaseName("string")
        .httpHeaders(Map.of("string", "string"))
        .isDefault(false)
        .accessMode("string")
        .name("string")
        .orgId("string")
        .secureJsonDataEncoded("string")
        .basicAuthEnabled(false)
        .uid("string")
        .url("string")
        .username("string")
        .build());
    
    data_source_resource = grafana.DataSource("dataSourceResource",
        type="string",
        json_data_encoded="string",
        basic_auth_username="string",
        database_name="string",
        http_headers={
            "string": "string",
        },
        is_default=False,
        access_mode="string",
        name="string",
        org_id="string",
        secure_json_data_encoded="string",
        basic_auth_enabled=False,
        uid="string",
        url="string",
        username="string")
    
    const dataSourceResource = new grafana.DataSource("dataSourceResource", {
        type: "string",
        jsonDataEncoded: "string",
        basicAuthUsername: "string",
        databaseName: "string",
        httpHeaders: {
            string: "string",
        },
        isDefault: false,
        accessMode: "string",
        name: "string",
        orgId: "string",
        secureJsonDataEncoded: "string",
        basicAuthEnabled: false,
        uid: "string",
        url: "string",
        username: "string",
    });
    
    type: grafana:DataSource
    properties:
        accessMode: string
        basicAuthEnabled: false
        basicAuthUsername: string
        databaseName: string
        httpHeaders:
            string: string
        isDefault: false
        jsonDataEncoded: string
        name: string
        orgId: string
        secureJsonDataEncoded: string
        type: string
        uid: string
        url: string
        username: string
    

    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

    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.5.1 published on Wednesday, Jun 12, 2024 by pulumiverse