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

grafana.Dashboard

Explore with Pulumi AI

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

    Manages Grafana dashboards.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as grafana from "@pulumiverse/grafana";
    
    const testFolder = new grafana.Folder("testFolder", {
        title: "My Folder",
        uid: "my-folder-uid",
    });
    const testDashboard = new grafana.Dashboard("testDashboard", {
        folder: testFolder.uid,
        configJson: JSON.stringify({
            title: "My Dashboard",
            uid: "my-dashboard-uid",
        }),
    });
    
    import pulumi
    import json
    import pulumiverse_grafana as grafana
    
    test_folder = grafana.Folder("testFolder",
        title="My Folder",
        uid="my-folder-uid")
    test_dashboard = grafana.Dashboard("testDashboard",
        folder=test_folder.uid,
        config_json=json.dumps({
            "title": "My Dashboard",
            "uid": "my-dashboard-uid",
        }))
    
    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 {
    		testFolder, err := grafana.NewFolder(ctx, "testFolder", &grafana.FolderArgs{
    			Title: pulumi.String("My Folder"),
    			Uid:   pulumi.String("my-folder-uid"),
    		})
    		if err != nil {
    			return err
    		}
    		tmpJSON0, err := json.Marshal(map[string]interface{}{
    			"title": "My Dashboard",
    			"uid":   "my-dashboard-uid",
    		})
    		if err != nil {
    			return err
    		}
    		json0 := string(tmpJSON0)
    		_, err = grafana.NewDashboard(ctx, "testDashboard", &grafana.DashboardArgs{
    			Folder:     testFolder.Uid,
    			ConfigJson: pulumi.String(json0),
    		})
    		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 testFolder = new Grafana.Folder("testFolder", new()
        {
            Title = "My Folder",
            Uid = "my-folder-uid",
        });
    
        var testDashboard = new Grafana.Dashboard("testDashboard", new()
        {
            Folder = testFolder.Uid,
            ConfigJson = JsonSerializer.Serialize(new Dictionary<string, object?>
            {
                ["title"] = "My Dashboard",
                ["uid"] = "my-dashboard-uid",
            }),
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.grafana.Folder;
    import com.pulumi.grafana.FolderArgs;
    import com.pulumi.grafana.Dashboard;
    import com.pulumi.grafana.DashboardArgs;
    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 testFolder = new Folder("testFolder", FolderArgs.builder()        
                .title("My Folder")
                .uid("my-folder-uid")
                .build());
    
            var testDashboard = new Dashboard("testDashboard", DashboardArgs.builder()        
                .folder(testFolder.uid())
                .configJson(serializeJson(
                    jsonObject(
                        jsonProperty("title", "My Dashboard"),
                        jsonProperty("uid", "my-dashboard-uid")
                    )))
                .build());
    
        }
    }
    
    resources:
      testFolder:
        type: grafana:Folder
        properties:
          title: My Folder
          uid: my-folder-uid
      testDashboard:
        type: grafana:Dashboard
        properties:
          folder: ${testFolder.uid}
          configJson:
            fn::toJSON:
              title: My Dashboard
              uid: my-dashboard-uid
    

    Create Dashboard Resource

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

    Constructor syntax

    new Dashboard(name: string, args: DashboardArgs, opts?: CustomResourceOptions);
    @overload
    def Dashboard(resource_name: str,
                  args: DashboardArgs,
                  opts: Optional[ResourceOptions] = None)
    
    @overload
    def Dashboard(resource_name: str,
                  opts: Optional[ResourceOptions] = None,
                  config_json: Optional[str] = None,
                  folder: Optional[str] = None,
                  message: Optional[str] = None,
                  org_id: Optional[str] = None,
                  overwrite: Optional[bool] = None)
    func NewDashboard(ctx *Context, name string, args DashboardArgs, opts ...ResourceOption) (*Dashboard, error)
    public Dashboard(string name, DashboardArgs args, CustomResourceOptions? opts = null)
    public Dashboard(String name, DashboardArgs args)
    public Dashboard(String name, DashboardArgs args, CustomResourceOptions options)
    
    type: grafana:Dashboard
    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 DashboardArgs
    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 DashboardArgs
    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 DashboardArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args DashboardArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args DashboardArgs
    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 dashboardResource = new Grafana.Dashboard("dashboardResource", new()
    {
        ConfigJson = "string",
        Folder = "string",
        Message = "string",
        OrgId = "string",
        Overwrite = false,
    });
    
    example, err := grafana.NewDashboard(ctx, "dashboardResource", &grafana.DashboardArgs{
    	ConfigJson: pulumi.String("string"),
    	Folder:     pulumi.String("string"),
    	Message:    pulumi.String("string"),
    	OrgId:      pulumi.String("string"),
    	Overwrite:  pulumi.Bool(false),
    })
    
    var dashboardResource = new Dashboard("dashboardResource", DashboardArgs.builder()
        .configJson("string")
        .folder("string")
        .message("string")
        .orgId("string")
        .overwrite(false)
        .build());
    
    dashboard_resource = grafana.Dashboard("dashboardResource",
        config_json="string",
        folder="string",
        message="string",
        org_id="string",
        overwrite=False)
    
    const dashboardResource = new grafana.Dashboard("dashboardResource", {
        configJson: "string",
        folder: "string",
        message: "string",
        orgId: "string",
        overwrite: false,
    });
    
    type: grafana:Dashboard
    properties:
        configJson: string
        folder: string
        message: string
        orgId: string
        overwrite: false
    

    Dashboard 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 Dashboard resource accepts the following input properties:

    ConfigJson string
    The complete dashboard model JSON.
    Folder string
    The id or UID of the folder to save the dashboard in.
    Message string
    Set a commit message for the version history.
    OrgId string
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    Overwrite bool
    Set to true if you want to overwrite existing dashboard with newer version, same dashboard title in folder or same dashboard uid.
    ConfigJson string
    The complete dashboard model JSON.
    Folder string
    The id or UID of the folder to save the dashboard in.
    Message string
    Set a commit message for the version history.
    OrgId string
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    Overwrite bool
    Set to true if you want to overwrite existing dashboard with newer version, same dashboard title in folder or same dashboard uid.
    configJson String
    The complete dashboard model JSON.
    folder String
    The id or UID of the folder to save the dashboard in.
    message String
    Set a commit message for the version history.
    orgId String
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    overwrite Boolean
    Set to true if you want to overwrite existing dashboard with newer version, same dashboard title in folder or same dashboard uid.
    configJson string
    The complete dashboard model JSON.
    folder string
    The id or UID of the folder to save the dashboard in.
    message string
    Set a commit message for the version history.
    orgId string
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    overwrite boolean
    Set to true if you want to overwrite existing dashboard with newer version, same dashboard title in folder or same dashboard uid.
    config_json str
    The complete dashboard model JSON.
    folder str
    The id or UID of the folder to save the dashboard in.
    message str
    Set a commit message for the version history.
    org_id str
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    overwrite bool
    Set to true if you want to overwrite existing dashboard with newer version, same dashboard title in folder or same dashboard uid.
    configJson String
    The complete dashboard model JSON.
    folder String
    The id or UID of the folder to save the dashboard in.
    message String
    Set a commit message for the version history.
    orgId String
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    overwrite Boolean
    Set to true if you want to overwrite existing dashboard with newer version, same dashboard title in folder or same dashboard uid.

    Outputs

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

    DashboardId int
    The numeric ID of the dashboard computed by Grafana.
    Id string
    The provider-assigned unique ID for this managed resource.
    Uid string
    The unique identifier of a dashboard. This is used to construct its URL. It's automatically generated if not provided when creating a dashboard. The uid allows having consistent URLs for accessing dashboards and when syncing dashboards between multiple Grafana installs.
    Url string
    The full URL of the dashboard.
    Version int
    Whenever you save a version of your dashboard, a copy of that version is saved so that previous versions of your dashboard are not lost.
    DashboardId int
    The numeric ID of the dashboard computed by Grafana.
    Id string
    The provider-assigned unique ID for this managed resource.
    Uid string
    The unique identifier of a dashboard. This is used to construct its URL. It's automatically generated if not provided when creating a dashboard. The uid allows having consistent URLs for accessing dashboards and when syncing dashboards between multiple Grafana installs.
    Url string
    The full URL of the dashboard.
    Version int
    Whenever you save a version of your dashboard, a copy of that version is saved so that previous versions of your dashboard are not lost.
    dashboardId Integer
    The numeric ID of the dashboard computed by Grafana.
    id String
    The provider-assigned unique ID for this managed resource.
    uid String
    The unique identifier of a dashboard. This is used to construct its URL. It's automatically generated if not provided when creating a dashboard. The uid allows having consistent URLs for accessing dashboards and when syncing dashboards between multiple Grafana installs.
    url String
    The full URL of the dashboard.
    version Integer
    Whenever you save a version of your dashboard, a copy of that version is saved so that previous versions of your dashboard are not lost.
    dashboardId number
    The numeric ID of the dashboard computed by Grafana.
    id string
    The provider-assigned unique ID for this managed resource.
    uid string
    The unique identifier of a dashboard. This is used to construct its URL. It's automatically generated if not provided when creating a dashboard. The uid allows having consistent URLs for accessing dashboards and when syncing dashboards between multiple Grafana installs.
    url string
    The full URL of the dashboard.
    version number
    Whenever you save a version of your dashboard, a copy of that version is saved so that previous versions of your dashboard are not lost.
    dashboard_id int
    The numeric ID of the dashboard computed by Grafana.
    id str
    The provider-assigned unique ID for this managed resource.
    uid str
    The unique identifier of a dashboard. This is used to construct its URL. It's automatically generated if not provided when creating a dashboard. The uid allows having consistent URLs for accessing dashboards and when syncing dashboards between multiple Grafana installs.
    url str
    The full URL of the dashboard.
    version int
    Whenever you save a version of your dashboard, a copy of that version is saved so that previous versions of your dashboard are not lost.
    dashboardId Number
    The numeric ID of the dashboard computed by Grafana.
    id String
    The provider-assigned unique ID for this managed resource.
    uid String
    The unique identifier of a dashboard. This is used to construct its URL. It's automatically generated if not provided when creating a dashboard. The uid allows having consistent URLs for accessing dashboards and when syncing dashboards between multiple Grafana installs.
    url String
    The full URL of the dashboard.
    version Number
    Whenever you save a version of your dashboard, a copy of that version is saved so that previous versions of your dashboard are not lost.

    Look up Existing Dashboard Resource

    Get an existing Dashboard 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?: DashboardState, opts?: CustomResourceOptions): Dashboard
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            config_json: Optional[str] = None,
            dashboard_id: Optional[int] = None,
            folder: Optional[str] = None,
            message: Optional[str] = None,
            org_id: Optional[str] = None,
            overwrite: Optional[bool] = None,
            uid: Optional[str] = None,
            url: Optional[str] = None,
            version: Optional[int] = None) -> Dashboard
    func GetDashboard(ctx *Context, name string, id IDInput, state *DashboardState, opts ...ResourceOption) (*Dashboard, error)
    public static Dashboard Get(string name, Input<string> id, DashboardState? state, CustomResourceOptions? opts = null)
    public static Dashboard get(String name, Output<String> id, DashboardState 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:
    ConfigJson string
    The complete dashboard model JSON.
    DashboardId int
    The numeric ID of the dashboard computed by Grafana.
    Folder string
    The id or UID of the folder to save the dashboard in.
    Message string
    Set a commit message for the version history.
    OrgId string
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    Overwrite bool
    Set to true if you want to overwrite existing dashboard with newer version, same dashboard title in folder or same dashboard uid.
    Uid string
    The unique identifier of a dashboard. This is used to construct its URL. It's automatically generated if not provided when creating a dashboard. The uid allows having consistent URLs for accessing dashboards and when syncing dashboards between multiple Grafana installs.
    Url string
    The full URL of the dashboard.
    Version int
    Whenever you save a version of your dashboard, a copy of that version is saved so that previous versions of your dashboard are not lost.
    ConfigJson string
    The complete dashboard model JSON.
    DashboardId int
    The numeric ID of the dashboard computed by Grafana.
    Folder string
    The id or UID of the folder to save the dashboard in.
    Message string
    Set a commit message for the version history.
    OrgId string
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    Overwrite bool
    Set to true if you want to overwrite existing dashboard with newer version, same dashboard title in folder or same dashboard uid.
    Uid string
    The unique identifier of a dashboard. This is used to construct its URL. It's automatically generated if not provided when creating a dashboard. The uid allows having consistent URLs for accessing dashboards and when syncing dashboards between multiple Grafana installs.
    Url string
    The full URL of the dashboard.
    Version int
    Whenever you save a version of your dashboard, a copy of that version is saved so that previous versions of your dashboard are not lost.
    configJson String
    The complete dashboard model JSON.
    dashboardId Integer
    The numeric ID of the dashboard computed by Grafana.
    folder String
    The id or UID of the folder to save the dashboard in.
    message String
    Set a commit message for the version history.
    orgId String
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    overwrite Boolean
    Set to true if you want to overwrite existing dashboard with newer version, same dashboard title in folder or same dashboard uid.
    uid String
    The unique identifier of a dashboard. This is used to construct its URL. It's automatically generated if not provided when creating a dashboard. The uid allows having consistent URLs for accessing dashboards and when syncing dashboards between multiple Grafana installs.
    url String
    The full URL of the dashboard.
    version Integer
    Whenever you save a version of your dashboard, a copy of that version is saved so that previous versions of your dashboard are not lost.
    configJson string
    The complete dashboard model JSON.
    dashboardId number
    The numeric ID of the dashboard computed by Grafana.
    folder string
    The id or UID of the folder to save the dashboard in.
    message string
    Set a commit message for the version history.
    orgId string
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    overwrite boolean
    Set to true if you want to overwrite existing dashboard with newer version, same dashboard title in folder or same dashboard uid.
    uid string
    The unique identifier of a dashboard. This is used to construct its URL. It's automatically generated if not provided when creating a dashboard. The uid allows having consistent URLs for accessing dashboards and when syncing dashboards between multiple Grafana installs.
    url string
    The full URL of the dashboard.
    version number
    Whenever you save a version of your dashboard, a copy of that version is saved so that previous versions of your dashboard are not lost.
    config_json str
    The complete dashboard model JSON.
    dashboard_id int
    The numeric ID of the dashboard computed by Grafana.
    folder str
    The id or UID of the folder to save the dashboard in.
    message str
    Set a commit message for the version history.
    org_id str
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    overwrite bool
    Set to true if you want to overwrite existing dashboard with newer version, same dashboard title in folder or same dashboard uid.
    uid str
    The unique identifier of a dashboard. This is used to construct its URL. It's automatically generated if not provided when creating a dashboard. The uid allows having consistent URLs for accessing dashboards and when syncing dashboards between multiple Grafana installs.
    url str
    The full URL of the dashboard.
    version int
    Whenever you save a version of your dashboard, a copy of that version is saved so that previous versions of your dashboard are not lost.
    configJson String
    The complete dashboard model JSON.
    dashboardId Number
    The numeric ID of the dashboard computed by Grafana.
    folder String
    The id or UID of the folder to save the dashboard in.
    message String
    Set a commit message for the version history.
    orgId String
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    overwrite Boolean
    Set to true if you want to overwrite existing dashboard with newer version, same dashboard title in folder or same dashboard uid.
    uid String
    The unique identifier of a dashboard. This is used to construct its URL. It's automatically generated if not provided when creating a dashboard. The uid allows having consistent URLs for accessing dashboards and when syncing dashboards between multiple Grafana installs.
    url String
    The full URL of the dashboard.
    version Number
    Whenever you save a version of your dashboard, a copy of that version is saved so that previous versions of your dashboard are not lost.

    Import

    $ pulumi import grafana:index/dashboard:Dashboard name "{{ uid }}"
    
    $ pulumi import grafana:index/dashboard:Dashboard 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