grafana.DashboardPermissionItem
Explore with Pulumi AI
Manages a single permission item for a dashboard. Conflicts with the “grafana.oss.DashboardPermission” resource which manages the entire set of permissions for a dashboard.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as grafana from "@pulumiverse/grafana";
const team = new grafana.oss.Team("team", {name: "Team Name"});
const user = new grafana.oss.User("user", {
email: "user.name@example.com",
password: "my-password",
login: "user.name",
});
const dashboard = new grafana.oss.Dashboard("dashboard", {configJson: JSON.stringify({
title: "My Dashboard",
uid: "my-dashboard-uid",
})});
const role = new grafana.oss.DashboardPermissionItem("role", {
dashboardUid: dashboard.uid,
role: "Viewer",
permission: "View",
});
const userDashboardPermissionItem = new grafana.oss.DashboardPermissionItem("user", {
dashboardUid: dashboard.uid,
user: user.id,
permission: "Admin",
});
const teamDashboardPermissionItem = new grafana.oss.DashboardPermissionItem("team", {
dashboardUid: dashboard.uid,
team: team.id,
permission: "Edit",
});
import pulumi
import json
import pulumiverse_grafana as grafana
team = grafana.oss.Team("team", name="Team Name")
user = grafana.oss.User("user",
email="user.name@example.com",
password="my-password",
login="user.name")
dashboard = grafana.oss.Dashboard("dashboard", config_json=json.dumps({
"title": "My Dashboard",
"uid": "my-dashboard-uid",
}))
role = grafana.oss.DashboardPermissionItem("role",
dashboard_uid=dashboard.uid,
role="Viewer",
permission="View")
user_dashboard_permission_item = grafana.oss.DashboardPermissionItem("user",
dashboard_uid=dashboard.uid,
user=user.id,
permission="Admin")
team_dashboard_permission_item = grafana.oss.DashboardPermissionItem("team",
dashboard_uid=dashboard.uid,
team=team.id,
permission="Edit")
package main
import (
"encoding/json"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumiverse/pulumi-grafana/sdk/go/grafana/oss"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
team, err := oss.NewTeam(ctx, "team", &oss.TeamArgs{
Name: pulumi.String("Team Name"),
})
if err != nil {
return err
}
user, err := oss.NewUser(ctx, "user", &oss.UserArgs{
Email: pulumi.String("user.name@example.com"),
Password: pulumi.String("my-password"),
Login: pulumi.String("user.name"),
})
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)
dashboard, err := oss.NewDashboard(ctx, "dashboard", &oss.DashboardArgs{
ConfigJson: pulumi.String(json0),
})
if err != nil {
return err
}
_, err = oss.NewDashboardPermissionItem(ctx, "role", &oss.DashboardPermissionItemArgs{
DashboardUid: dashboard.Uid,
Role: pulumi.String("Viewer"),
Permission: pulumi.String("View"),
})
if err != nil {
return err
}
_, err = oss.NewDashboardPermissionItem(ctx, "user", &oss.DashboardPermissionItemArgs{
DashboardUid: dashboard.Uid,
User: user.ID(),
Permission: pulumi.String("Admin"),
})
if err != nil {
return err
}
_, err = oss.NewDashboardPermissionItem(ctx, "team", &oss.DashboardPermissionItemArgs{
DashboardUid: dashboard.Uid,
Team: team.ID(),
Permission: pulumi.String("Edit"),
})
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 team = new Grafana.Oss.Team("team", new()
{
Name = "Team Name",
});
var user = new Grafana.Oss.User("user", new()
{
Email = "user.name@example.com",
Password = "my-password",
Login = "user.name",
});
var dashboard = new Grafana.Oss.Dashboard("dashboard", new()
{
ConfigJson = JsonSerializer.Serialize(new Dictionary<string, object?>
{
["title"] = "My Dashboard",
["uid"] = "my-dashboard-uid",
}),
});
var role = new Grafana.Oss.DashboardPermissionItem("role", new()
{
DashboardUid = dashboard.Uid,
Role = "Viewer",
Permission = "View",
});
var userDashboardPermissionItem = new Grafana.Oss.DashboardPermissionItem("user", new()
{
DashboardUid = dashboard.Uid,
User = user.Id,
Permission = "Admin",
});
var teamDashboardPermissionItem = new Grafana.Oss.DashboardPermissionItem("team", new()
{
DashboardUid = dashboard.Uid,
Team = team.Id,
Permission = "Edit",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.grafana.oss.Team;
import com.pulumi.grafana.oss.TeamArgs;
import com.pulumi.grafana.oss.User;
import com.pulumi.grafana.oss.UserArgs;
import com.pulumi.grafana.oss.Dashboard;
import com.pulumi.grafana.oss.DashboardArgs;
import com.pulumi.grafana.oss.DashboardPermissionItem;
import com.pulumi.grafana.oss.DashboardPermissionItemArgs;
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 team = new Team("team", TeamArgs.builder()
.name("Team Name")
.build());
var user = new User("user", UserArgs.builder()
.email("user.name@example.com")
.password("my-password")
.login("user.name")
.build());
var dashboard = new Dashboard("dashboard", DashboardArgs.builder()
.configJson(serializeJson(
jsonObject(
jsonProperty("title", "My Dashboard"),
jsonProperty("uid", "my-dashboard-uid")
)))
.build());
var role = new DashboardPermissionItem("role", DashboardPermissionItemArgs.builder()
.dashboardUid(dashboard.uid())
.role("Viewer")
.permission("View")
.build());
var userDashboardPermissionItem = new DashboardPermissionItem("userDashboardPermissionItem", DashboardPermissionItemArgs.builder()
.dashboardUid(dashboard.uid())
.user(user.id())
.permission("Admin")
.build());
var teamDashboardPermissionItem = new DashboardPermissionItem("teamDashboardPermissionItem", DashboardPermissionItemArgs.builder()
.dashboardUid(dashboard.uid())
.team(team.id())
.permission("Edit")
.build());
}
}
resources:
team:
type: grafana:oss:Team
properties:
name: Team Name
user:
type: grafana:oss:User
properties:
email: user.name@example.com
password: my-password
login: user.name
dashboard:
type: grafana:oss:Dashboard
properties:
configJson:
fn::toJSON:
title: My Dashboard
uid: my-dashboard-uid
role:
type: grafana:oss:DashboardPermissionItem
properties:
dashboardUid: ${dashboard.uid}
role: Viewer
permission: View
userDashboardPermissionItem:
type: grafana:oss:DashboardPermissionItem
name: user
properties:
dashboardUid: ${dashboard.uid}
user: ${user.id}
permission: Admin
teamDashboardPermissionItem:
type: grafana:oss:DashboardPermissionItem
name: team
properties:
dashboardUid: ${dashboard.uid}
team: ${team.id}
permission: Edit
Create DashboardPermissionItem Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new DashboardPermissionItem(name: string, args: DashboardPermissionItemArgs, opts?: CustomResourceOptions);
@overload
def DashboardPermissionItem(resource_name: str,
args: DashboardPermissionItemArgs,
opts: Optional[ResourceOptions] = None)
@overload
def DashboardPermissionItem(resource_name: str,
opts: Optional[ResourceOptions] = None,
dashboard_uid: Optional[str] = None,
org_id: Optional[str] = None,
permission: Optional[str] = None,
role: Optional[str] = None,
team: Optional[str] = None,
user: Optional[str] = None)
func NewDashboardPermissionItem(ctx *Context, name string, args DashboardPermissionItemArgs, opts ...ResourceOption) (*DashboardPermissionItem, error)
public DashboardPermissionItem(string name, DashboardPermissionItemArgs args, CustomResourceOptions? opts = null)
public DashboardPermissionItem(String name, DashboardPermissionItemArgs args)
public DashboardPermissionItem(String name, DashboardPermissionItemArgs args, CustomResourceOptions options)
type: grafana:DashboardPermissionItem
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 DashboardPermissionItemArgs
- 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 DashboardPermissionItemArgs
- 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 DashboardPermissionItemArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args DashboardPermissionItemArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args DashboardPermissionItemArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
DashboardPermissionItem Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The DashboardPermissionItem resource accepts the following input properties:
- Dashboard
Uid string - The UID of the dashboard.
- Permission string
- the permission to be assigned
- Org
Id string - The Organization ID. If not set, the Org ID defined in the provider block will be used.
- Role string
- the role onto which the permission is to be assigned
- Team string
- the team onto which the permission is to be assigned
- User string
- the user or service account onto which the permission is to be assigned
- Dashboard
Uid string - The UID of the dashboard.
- Permission string
- the permission to be assigned
- Org
Id string - The Organization ID. If not set, the Org ID defined in the provider block will be used.
- Role string
- the role onto which the permission is to be assigned
- Team string
- the team onto which the permission is to be assigned
- User string
- the user or service account onto which the permission is to be assigned
- dashboard
Uid String - The UID of the dashboard.
- permission String
- the permission to be assigned
- org
Id String - The Organization ID. If not set, the Org ID defined in the provider block will be used.
- role String
- the role onto which the permission is to be assigned
- team String
- the team onto which the permission is to be assigned
- user String
- the user or service account onto which the permission is to be assigned
- dashboard
Uid string - The UID of the dashboard.
- permission string
- the permission to be assigned
- org
Id string - The Organization ID. If not set, the Org ID defined in the provider block will be used.
- role string
- the role onto which the permission is to be assigned
- team string
- the team onto which the permission is to be assigned
- user string
- the user or service account onto which the permission is to be assigned
- dashboard_
uid str - The UID of the dashboard.
- permission str
- the permission to be assigned
- org_
id str - The Organization ID. If not set, the Org ID defined in the provider block will be used.
- role str
- the role onto which the permission is to be assigned
- team str
- the team onto which the permission is to be assigned
- user str
- the user or service account onto which the permission is to be assigned
- dashboard
Uid String - The UID of the dashboard.
- permission String
- the permission to be assigned
- org
Id String - The Organization ID. If not set, the Org ID defined in the provider block will be used.
- role String
- the role onto which the permission is to be assigned
- team String
- the team onto which the permission is to be assigned
- user String
- the user or service account onto which the permission is to be assigned
Outputs
All input properties are implicitly available as output properties. Additionally, the DashboardPermissionItem 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 DashboardPermissionItem Resource
Get an existing DashboardPermissionItem 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?: DashboardPermissionItemState, opts?: CustomResourceOptions): DashboardPermissionItem
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
dashboard_uid: Optional[str] = None,
org_id: Optional[str] = None,
permission: Optional[str] = None,
role: Optional[str] = None,
team: Optional[str] = None,
user: Optional[str] = None) -> DashboardPermissionItem
func GetDashboardPermissionItem(ctx *Context, name string, id IDInput, state *DashboardPermissionItemState, opts ...ResourceOption) (*DashboardPermissionItem, error)
public static DashboardPermissionItem Get(string name, Input<string> id, DashboardPermissionItemState? state, CustomResourceOptions? opts = null)
public static DashboardPermissionItem get(String name, Output<String> id, DashboardPermissionItemState 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.
- Dashboard
Uid string - The UID of the dashboard.
- Org
Id string - The Organization ID. If not set, the Org ID defined in the provider block will be used.
- Permission string
- the permission to be assigned
- Role string
- the role onto which the permission is to be assigned
- Team string
- the team onto which the permission is to be assigned
- User string
- the user or service account onto which the permission is to be assigned
- Dashboard
Uid string - The UID of the dashboard.
- Org
Id string - The Organization ID. If not set, the Org ID defined in the provider block will be used.
- Permission string
- the permission to be assigned
- Role string
- the role onto which the permission is to be assigned
- Team string
- the team onto which the permission is to be assigned
- User string
- the user or service account onto which the permission is to be assigned
- dashboard
Uid String - The UID of the dashboard.
- org
Id String - The Organization ID. If not set, the Org ID defined in the provider block will be used.
- permission String
- the permission to be assigned
- role String
- the role onto which the permission is to be assigned
- team String
- the team onto which the permission is to be assigned
- user String
- the user or service account onto which the permission is to be assigned
- dashboard
Uid string - The UID of the dashboard.
- org
Id string - The Organization ID. If not set, the Org ID defined in the provider block will be used.
- permission string
- the permission to be assigned
- role string
- the role onto which the permission is to be assigned
- team string
- the team onto which the permission is to be assigned
- user string
- the user or service account onto which the permission is to be assigned
- dashboard_
uid str - The UID of the dashboard.
- org_
id str - The Organization ID. If not set, the Org ID defined in the provider block will be used.
- permission str
- the permission to be assigned
- role str
- the role onto which the permission is to be assigned
- team str
- the team onto which the permission is to be assigned
- user str
- the user or service account onto which the permission is to be assigned
- dashboard
Uid String - The UID of the dashboard.
- org
Id String - The Organization ID. If not set, the Org ID defined in the provider block will be used.
- permission String
- the permission to be assigned
- role String
- the role onto which the permission is to be assigned
- team String
- the team onto which the permission is to be assigned
- user String
- the user or service account onto which the permission is to be assigned
Import
$ pulumi import grafana:index/dashboardPermissionItem:DashboardPermissionItem name "{{ dashboardUID }}:{{ type (role, team, or user) }}:{{ identifier }}"
$ pulumi import grafana:index/dashboardPermissionItem:DashboardPermissionItem name "{{ orgID }}:{{ dashboardUID }}:{{ type (role, team, or user) }}:{{ identifier }}"
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.