grafana.Dashboard
Explore with Pulumi AI
Manages Grafana dashboards.
Example Usage
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Pulumi;
using Grafana = Lbrlabs.PulumiPackage.Grafana;
return await Deployment.RunAsync(() =>
{
var metrics = new Grafana.Dashboard("metrics", new()
{
ConfigJson = File.ReadAllText("grafana-dashboard.json"),
});
});
package main
import (
"os"
"github.com/lbrlabs/pulumi-grafana/sdk/go/grafana"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func readFileOrPanic(path string) pulumi.StringPtrInput {
data, err := os.ReadFile(path)
if err != nil {
panic(err.Error())
}
return pulumi.String(string(data))
}
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := grafana.NewDashboard(ctx, "metrics", &grafana.DashboardArgs{
ConfigJson: readFileOrPanic("grafana-dashboard.json"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.grafana.Dashboard;
import com.pulumi.grafana.DashboardArgs;
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 metrics = new Dashboard("metrics", DashboardArgs.builder()
.configJson(Files.readString(Paths.get("grafana-dashboard.json")))
.build());
}
}
import pulumi
import lbrlabs_pulumi_grafana as grafana
metrics = grafana.Dashboard("metrics", config_json=(lambda path: open(path).read())("grafana-dashboard.json"))
import * as pulumi from "@pulumi/pulumi";
import * as fs from "fs";
import * as grafana from "@lbrlabs/pulumi-grafana";
const metrics = new grafana.Dashboard("metrics", {configJson: fs.readFileSync("grafana-dashboard.json")});
resources:
metrics:
type: grafana:Dashboard
properties:
configJson:
fn::readFile: grafana-dashboard.json
Create Dashboard Resource
new Dashboard(name: string, args: DashboardArgs, opts?: CustomResourceOptions);
@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)
@overload
def Dashboard(resource_name: str,
args: DashboardArgs,
opts: Optional[ResourceOptions] = 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.
- 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.
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:
- Config
Json 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.
- Org
Id 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.
- Config
Json 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.
- Org
Id 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.
- config
Json 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.
- org
Id 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 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.
- org
Id 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.
- config
Json 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.
- org
Id 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:
- Dashboard
Id int The numeric ID of the dashboard computed by Grafana.
- Id string
The provider-assigned unique ID for this managed resource.
- Slug string
URL friendly version of the dashboard title. This field is deprecated, please use
uid
instead.Use
uid
instead.- 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.
- Dashboard
Id int The numeric ID of the dashboard computed by Grafana.
- Id string
The provider-assigned unique ID for this managed resource.
- Slug string
URL friendly version of the dashboard title. This field is deprecated, please use
uid
instead.Use
uid
instead.- 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.
- dashboard
Id Integer The numeric ID of the dashboard computed by Grafana.
- id String
The provider-assigned unique ID for this managed resource.
- slug String
URL friendly version of the dashboard title. This field is deprecated, please use
uid
instead.Use
uid
instead.- 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.
- dashboard
Id number The numeric ID of the dashboard computed by Grafana.
- id string
The provider-assigned unique ID for this managed resource.
- slug string
URL friendly version of the dashboard title. This field is deprecated, please use
uid
instead.Use
uid
instead.- 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.
- slug str
URL friendly version of the dashboard title. This field is deprecated, please use
uid
instead.Use
uid
instead.- 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.
- dashboard
Id Number The numeric ID of the dashboard computed by Grafana.
- id String
The provider-assigned unique ID for this managed resource.
- slug String
URL friendly version of the dashboard title. This field is deprecated, please use
uid
instead.Use
uid
instead.- 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,
slug: Optional[str] = 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.
- Config
Json string The complete dashboard model JSON.
- Dashboard
Id 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.
- Org
Id 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.
- Slug string
URL friendly version of the dashboard title. This field is deprecated, please use
uid
instead.Use
uid
instead.- 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.
- Config
Json string The complete dashboard model JSON.
- Dashboard
Id 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.
- Org
Id 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.
- Slug string
URL friendly version of the dashboard title. This field is deprecated, please use
uid
instead.Use
uid
instead.- 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.
- config
Json String The complete dashboard model JSON.
- dashboard
Id 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.
- org
Id 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.
- slug String
URL friendly version of the dashboard title. This field is deprecated, please use
uid
instead.Use
uid
instead.- 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.
- config
Json string The complete dashboard model JSON.
- dashboard
Id 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.
- org
Id 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.
- slug string
URL friendly version of the dashboard title. This field is deprecated, please use
uid
instead.Use
uid
instead.- 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.
- slug str
URL friendly version of the dashboard title. This field is deprecated, please use
uid
instead.Use
uid
instead.- 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.
- config
Json String The complete dashboard model JSON.
- dashboard
Id 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.
- org
Id 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.
- slug String
URL friendly version of the dashboard title. This field is deprecated, please use
uid
instead.Use
uid
instead.- 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 dashboard_name {{dashboard_uid}} # To use the default provider org
$ pulumi import grafana:index/dashboard:Dashboard dashboard_name {{org_id}}:{{dashboard_uid}} # When "org_id" is set on the resource
Package Details
- Repository
- grafana lbrlabs/pulumi-grafana
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
grafana
Terraform Provider.