grafana logo
Grafana v0.0.10, May 21 23

grafana.Role

Explore with Pulumi AI

Note: This resource is available only with Grafana Enterprise 8.+.

Example Usage

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Grafana = Lbrlabs.PulumiPackage.Grafana;

return await Deployment.RunAsync(() => 
{
    var superUser = new Grafana.Role("superUser", new()
    {
        Description = "My Super User description",
        Global = true,
        Permissions = new[]
        {
            new Grafana.Inputs.RolePermissionArgs
            {
                Action = "org.users:add",
                Scope = "users:*",
            },
            new Grafana.Inputs.RolePermissionArgs
            {
                Action = "org.users:write",
                Scope = "users:*",
            },
            new Grafana.Inputs.RolePermissionArgs
            {
                Action = "org.users:read",
                Scope = "users:*",
            },
        },
        Uid = "superuseruid",
        Version = 1,
    });

});
package main

import (
	"github.com/lbrlabs/pulumi-grafana/sdk/go/grafana"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := grafana.NewRole(ctx, "superUser", &grafana.RoleArgs{
			Description: pulumi.String("My Super User description"),
			Global:      pulumi.Bool(true),
			Permissions: grafana.RolePermissionArray{
				&grafana.RolePermissionArgs{
					Action: pulumi.String("org.users:add"),
					Scope:  pulumi.String("users:*"),
				},
				&grafana.RolePermissionArgs{
					Action: pulumi.String("org.users:write"),
					Scope:  pulumi.String("users:*"),
				},
				&grafana.RolePermissionArgs{
					Action: pulumi.String("org.users:read"),
					Scope:  pulumi.String("users:*"),
				},
			},
			Uid:     pulumi.String("superuseruid"),
			Version: pulumi.Int(1),
		})
		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.Role;
import com.pulumi.grafana.RoleArgs;
import com.pulumi.grafana.inputs.RolePermissionArgs;
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 superUser = new Role("superUser", RoleArgs.builder()        
            .description("My Super User description")
            .global(true)
            .permissions(            
                RolePermissionArgs.builder()
                    .action("org.users:add")
                    .scope("users:*")
                    .build(),
                RolePermissionArgs.builder()
                    .action("org.users:write")
                    .scope("users:*")
                    .build(),
                RolePermissionArgs.builder()
                    .action("org.users:read")
                    .scope("users:*")
                    .build())
            .uid("superuseruid")
            .version(1)
            .build());

    }
}
import pulumi
import lbrlabs_pulumi_grafana as grafana

super_user = grafana.Role("superUser",
    description="My Super User description",
    global_=True,
    permissions=[
        grafana.RolePermissionArgs(
            action="org.users:add",
            scope="users:*",
        ),
        grafana.RolePermissionArgs(
            action="org.users:write",
            scope="users:*",
        ),
        grafana.RolePermissionArgs(
            action="org.users:read",
            scope="users:*",
        ),
    ],
    uid="superuseruid",
    version=1)
import * as pulumi from "@pulumi/pulumi";
import * as grafana from "@lbrlabs/pulumi-grafana";

const superUser = new grafana.Role("superUser", {
    description: "My Super User description",
    global: true,
    permissions: [
        {
            action: "org.users:add",
            scope: "users:*",
        },
        {
            action: "org.users:write",
            scope: "users:*",
        },
        {
            action: "org.users:read",
            scope: "users:*",
        },
    ],
    uid: "superuseruid",
    version: 1,
});
resources:
  superUser:
    type: grafana:Role
    properties:
      description: My Super User description
      global: true
      permissions:
        - action: org.users:add
          scope: users:*
        - action: org.users:write
          scope: users:*
        - action: org.users:read
          scope: users:*
      uid: superuseruid
      version: 1

Create Role Resource

new Role(name: string, args: RoleArgs, opts?: CustomResourceOptions);
@overload
def Role(resource_name: str,
         opts: Optional[ResourceOptions] = None,
         description: Optional[str] = None,
         display_name: Optional[str] = None,
         global_: Optional[bool] = None,
         group: Optional[str] = None,
         hidden: Optional[bool] = None,
         name: Optional[str] = None,
         permissions: Optional[Sequence[RolePermissionArgs]] = None,
         uid: Optional[str] = None,
         version: Optional[int] = None)
@overload
def Role(resource_name: str,
         args: RoleArgs,
         opts: Optional[ResourceOptions] = None)
func NewRole(ctx *Context, name string, args RoleArgs, opts ...ResourceOption) (*Role, error)
public Role(string name, RoleArgs args, CustomResourceOptions? opts = null)
public Role(String name, RoleArgs args)
public Role(String name, RoleArgs args, CustomResourceOptions options)
type: grafana:Role
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args RoleArgs
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 RoleArgs
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 RoleArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args RoleArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args RoleArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

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

Version int

Version of the role. A role is updated only on version increase.

Description string

Description of the role.

DisplayName string

Display name of the role. Available with Grafana 8.5+.

Global bool

Boolean to state whether the role is available across all organizations or not. Defaults to false.

Group string

Group of the role. Available with Grafana 8.5+.

Hidden bool

Boolean to state whether the role should be visible in the Grafana UI or not. Available with Grafana 8.5+. Defaults to false.

Name string

Name of the role

Permissions List<Lbrlabs.PulumiPackage.Grafana.Inputs.RolePermissionArgs>

Specific set of actions granted by the role.

Uid string

Unique identifier of the role. Used for assignments.

Version int

Version of the role. A role is updated only on version increase.

Description string

Description of the role.

DisplayName string

Display name of the role. Available with Grafana 8.5+.

Global bool

Boolean to state whether the role is available across all organizations or not. Defaults to false.

Group string

Group of the role. Available with Grafana 8.5+.

Hidden bool

Boolean to state whether the role should be visible in the Grafana UI or not. Available with Grafana 8.5+. Defaults to false.

Name string

Name of the role

Permissions []RolePermissionArgs

Specific set of actions granted by the role.

Uid string

Unique identifier of the role. Used for assignments.

version Integer

Version of the role. A role is updated only on version increase.

description String

Description of the role.

displayName String

Display name of the role. Available with Grafana 8.5+.

global Boolean

Boolean to state whether the role is available across all organizations or not. Defaults to false.

group String

Group of the role. Available with Grafana 8.5+.

hidden Boolean

Boolean to state whether the role should be visible in the Grafana UI or not. Available with Grafana 8.5+. Defaults to false.

name String

Name of the role

permissions List<RolePermissionArgs>

Specific set of actions granted by the role.

uid String

Unique identifier of the role. Used for assignments.

version number

Version of the role. A role is updated only on version increase.

description string

Description of the role.

displayName string

Display name of the role. Available with Grafana 8.5+.

global boolean

Boolean to state whether the role is available across all organizations or not. Defaults to false.

group string

Group of the role. Available with Grafana 8.5+.

hidden boolean

Boolean to state whether the role should be visible in the Grafana UI or not. Available with Grafana 8.5+. Defaults to false.

name string

Name of the role

permissions RolePermissionArgs[]

Specific set of actions granted by the role.

uid string

Unique identifier of the role. Used for assignments.

version int

Version of the role. A role is updated only on version increase.

description str

Description of the role.

display_name str

Display name of the role. Available with Grafana 8.5+.

global_ bool

Boolean to state whether the role is available across all organizations or not. Defaults to false.

group str

Group of the role. Available with Grafana 8.5+.

hidden bool

Boolean to state whether the role should be visible in the Grafana UI or not. Available with Grafana 8.5+. Defaults to false.

name str

Name of the role

permissions Sequence[RolePermissionArgs]

Specific set of actions granted by the role.

uid str

Unique identifier of the role. Used for assignments.

version Number

Version of the role. A role is updated only on version increase.

description String

Description of the role.

displayName String

Display name of the role. Available with Grafana 8.5+.

global Boolean

Boolean to state whether the role is available across all organizations or not. Defaults to false.

group String

Group of the role. Available with Grafana 8.5+.

hidden Boolean

Boolean to state whether the role should be visible in the Grafana UI or not. Available with Grafana 8.5+. Defaults to false.

name String

Name of the role

permissions List<Property Map>

Specific set of actions granted by the role.

uid String

Unique identifier of the role. Used for assignments.

Outputs

All input properties are implicitly available as output properties. Additionally, the Role 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 Role Resource

Get an existing Role 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?: RoleState, opts?: CustomResourceOptions): Role
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        description: Optional[str] = None,
        display_name: Optional[str] = None,
        global_: Optional[bool] = None,
        group: Optional[str] = None,
        hidden: Optional[bool] = None,
        name: Optional[str] = None,
        permissions: Optional[Sequence[RolePermissionArgs]] = None,
        uid: Optional[str] = None,
        version: Optional[int] = None) -> Role
func GetRole(ctx *Context, name string, id IDInput, state *RoleState, opts ...ResourceOption) (*Role, error)
public static Role Get(string name, Input<string> id, RoleState? state, CustomResourceOptions? opts = null)
public static Role get(String name, Output<String> id, RoleState 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:
Description string

Description of the role.

DisplayName string

Display name of the role. Available with Grafana 8.5+.

Global bool

Boolean to state whether the role is available across all organizations or not. Defaults to false.

Group string

Group of the role. Available with Grafana 8.5+.

Hidden bool

Boolean to state whether the role should be visible in the Grafana UI or not. Available with Grafana 8.5+. Defaults to false.

Name string

Name of the role

Permissions List<Lbrlabs.PulumiPackage.Grafana.Inputs.RolePermissionArgs>

Specific set of actions granted by the role.

Uid string

Unique identifier of the role. Used for assignments.

Version int

Version of the role. A role is updated only on version increase.

Description string

Description of the role.

DisplayName string

Display name of the role. Available with Grafana 8.5+.

Global bool

Boolean to state whether the role is available across all organizations or not. Defaults to false.

Group string

Group of the role. Available with Grafana 8.5+.

Hidden bool

Boolean to state whether the role should be visible in the Grafana UI or not. Available with Grafana 8.5+. Defaults to false.

Name string

Name of the role

Permissions []RolePermissionArgs

Specific set of actions granted by the role.

Uid string

Unique identifier of the role. Used for assignments.

Version int

Version of the role. A role is updated only on version increase.

description String

Description of the role.

displayName String

Display name of the role. Available with Grafana 8.5+.

global Boolean

Boolean to state whether the role is available across all organizations or not. Defaults to false.

group String

Group of the role. Available with Grafana 8.5+.

hidden Boolean

Boolean to state whether the role should be visible in the Grafana UI or not. Available with Grafana 8.5+. Defaults to false.

name String

Name of the role

permissions List<RolePermissionArgs>

Specific set of actions granted by the role.

uid String

Unique identifier of the role. Used for assignments.

version Integer

Version of the role. A role is updated only on version increase.

description string

Description of the role.

displayName string

Display name of the role. Available with Grafana 8.5+.

global boolean

Boolean to state whether the role is available across all organizations or not. Defaults to false.

group string

Group of the role. Available with Grafana 8.5+.

hidden boolean

Boolean to state whether the role should be visible in the Grafana UI or not. Available with Grafana 8.5+. Defaults to false.

name string

Name of the role

permissions RolePermissionArgs[]

Specific set of actions granted by the role.

uid string

Unique identifier of the role. Used for assignments.

version number

Version of the role. A role is updated only on version increase.

description str

Description of the role.

display_name str

Display name of the role. Available with Grafana 8.5+.

global_ bool

Boolean to state whether the role is available across all organizations or not. Defaults to false.

group str

Group of the role. Available with Grafana 8.5+.

hidden bool

Boolean to state whether the role should be visible in the Grafana UI or not. Available with Grafana 8.5+. Defaults to false.

name str

Name of the role

permissions Sequence[RolePermissionArgs]

Specific set of actions granted by the role.

uid str

Unique identifier of the role. Used for assignments.

version int

Version of the role. A role is updated only on version increase.

description String

Description of the role.

displayName String

Display name of the role. Available with Grafana 8.5+.

global Boolean

Boolean to state whether the role is available across all organizations or not. Defaults to false.

group String

Group of the role. Available with Grafana 8.5+.

hidden Boolean

Boolean to state whether the role should be visible in the Grafana UI or not. Available with Grafana 8.5+. Defaults to false.

name String

Name of the role

permissions List<Property Map>

Specific set of actions granted by the role.

uid String

Unique identifier of the role. Used for assignments.

version Number

Version of the role. A role is updated only on version increase.

Supporting Types

RolePermission

Action string

Specific action users granted with the role will be allowed to perform (for example: users:read)

Scope string

Scope to restrict the action to a set of resources (for example: users:* or roles:customrole1) Defaults to ``.

Action string

Specific action users granted with the role will be allowed to perform (for example: users:read)

Scope string

Scope to restrict the action to a set of resources (for example: users:* or roles:customrole1) Defaults to ``.

action String

Specific action users granted with the role will be allowed to perform (for example: users:read)

scope String

Scope to restrict the action to a set of resources (for example: users:* or roles:customrole1) Defaults to ``.

action string

Specific action users granted with the role will be allowed to perform (for example: users:read)

scope string

Scope to restrict the action to a set of resources (for example: users:* or roles:customrole1) Defaults to ``.

action str

Specific action users granted with the role will be allowed to perform (for example: users:read)

scope str

Scope to restrict the action to a set of resources (for example: users:* or roles:customrole1) Defaults to ``.

action String

Specific action users granted with the role will be allowed to perform (for example: users:read)

scope String

Scope to restrict the action to a set of resources (for example: users:* or roles:customrole1) Defaults to ``.

Import

 $ pulumi import grafana:index/role:Role role_name {{uid}}

Package Details

Repository
grafana lbrlabs/pulumi-grafana
License
Apache-2.0
Notes

This Pulumi package is based on the grafana Terraform Provider.