1. Packages
  2. Grafana Cloud
  3. API Docs
  4. Role
Grafana v0.7.0 published on Tuesday, Nov 5, 2024 by pulumiverse

grafana.Role

Explore with Pulumi AI

grafana logo
Grafana v0.7.0 published on Tuesday, Nov 5, 2024 by pulumiverse
    Deprecated: grafana.index/role.Role has been deprecated in favor of grafana.enterprise/role.Role

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

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as grafana from "@pulumiverse/grafana";
    
    const superUser = new grafana.enterprise.Role("super_user", {
        name: "Super User",
        description: "My Super User description",
        uid: "superuseruid",
        version: 1,
        global: true,
        permissions: [
            {
                action: "org.users:add",
                scope: "users:*",
            },
            {
                action: "org.users:write",
                scope: "users:*",
            },
            {
                action: "org.users:read",
                scope: "users:*",
            },
        ],
    });
    
    import pulumi
    import pulumiverse_grafana as grafana
    
    super_user = grafana.enterprise.Role("super_user",
        name="Super User",
        description="My Super User description",
        uid="superuseruid",
        version=1,
        global_=True,
        permissions=[
            {
                "action": "org.users:add",
                "scope": "users:*",
            },
            {
                "action": "org.users:write",
                "scope": "users:*",
            },
            {
                "action": "org.users:read",
                "scope": "users:*",
            },
        ])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumiverse/pulumi-grafana/sdk/go/grafana/enterprise"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := enterprise.NewRole(ctx, "super_user", &enterprise.RoleArgs{
    			Name:        pulumi.String("Super User"),
    			Description: pulumi.String("My Super User description"),
    			Uid:         pulumi.String("superuseruid"),
    			Version:     pulumi.Int(1),
    			Global:      pulumi.Bool(true),
    			Permissions: enterprise.RolePermissionArray{
    				&enterprise.RolePermissionArgs{
    					Action: pulumi.String("org.users:add"),
    					Scope:  pulumi.String("users:*"),
    				},
    				&enterprise.RolePermissionArgs{
    					Action: pulumi.String("org.users:write"),
    					Scope:  pulumi.String("users:*"),
    				},
    				&enterprise.RolePermissionArgs{
    					Action: pulumi.String("org.users:read"),
    					Scope:  pulumi.String("users:*"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Grafana = Pulumiverse.Grafana;
    
    return await Deployment.RunAsync(() => 
    {
        var superUser = new Grafana.Enterprise.Role("super_user", new()
        {
            Name = "Super User",
            Description = "My Super User description",
            Uid = "superuseruid",
            Version = 1,
            Global = true,
            Permissions = new[]
            {
                new Grafana.Enterprise.Inputs.RolePermissionArgs
                {
                    Action = "org.users:add",
                    Scope = "users:*",
                },
                new Grafana.Enterprise.Inputs.RolePermissionArgs
                {
                    Action = "org.users:write",
                    Scope = "users:*",
                },
                new Grafana.Enterprise.Inputs.RolePermissionArgs
                {
                    Action = "org.users:read",
                    Scope = "users:*",
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.grafana.enterprise.Role;
    import com.pulumi.grafana.enterprise.RoleArgs;
    import com.pulumi.grafana.enterprise.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()
                .name("Super User")
                .description("My Super User description")
                .uid("superuseruid")
                .version(1)
                .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())
                .build());
    
        }
    }
    
    resources:
      superUser:
        type: grafana:enterprise:Role
        name: super_user
        properties:
          name: Super User
          description: My Super User description
          uid: superuseruid
          version: 1
          global: true
          permissions:
            - action: org.users:add
              scope: users:*
            - action: org.users:write
              scope: users:*
            - action: org.users:read
              scope: users:*
    

    Create Role Resource

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

    Constructor syntax

    new Role(name: string, args?: RoleArgs, opts?: CustomResourceOptions);
    @overload
    def Role(resource_name: str,
             args: Optional[RoleArgs] = None,
             opts: Optional[ResourceOptions] = None)
    
    @overload
    def Role(resource_name: str,
             opts: Optional[ResourceOptions] = None,
             auto_increment_version: Optional[bool] = 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,
             org_id: Optional[str] = None,
             permissions: Optional[Sequence[RolePermissionArgs]] = None,
             uid: Optional[str] = None,
             version: Optional[int] = None)
    func NewRole(ctx *Context, name string, args *RoleArgs, opts ...ResourceOption) (*Role, error)
    public Role(string name, RoleArgs? args = null, 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.
    
    

    Parameters

    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

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The Role resource accepts the following input properties:

    AutoIncrementVersion bool
    Whether the role version should be incremented automatically on updates (and set to 1 on creation). This field or version should be set.
    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
    OrgId string
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    Permissions List<Pulumiverse.Grafana.Inputs.RolePermission>
    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. This field or auto_increment_version should be set.
    AutoIncrementVersion bool
    Whether the role version should be incremented automatically on updates (and set to 1 on creation). This field or version should be set.
    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
    OrgId string
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    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. This field or auto_increment_version should be set.
    autoIncrementVersion Boolean
    Whether the role version should be incremented automatically on updates (and set to 1 on creation). This field or version should be set.
    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
    orgId String
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    permissions List<RolePermission>
    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. This field or auto_increment_version should be set.
    autoIncrementVersion boolean
    Whether the role version should be incremented automatically on updates (and set to 1 on creation). This field or version should be set.
    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
    orgId string
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    permissions RolePermission[]
    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. This field or auto_increment_version should be set.
    auto_increment_version bool
    Whether the role version should be incremented automatically on updates (and set to 1 on creation). This field or version should be set.
    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
    org_id str
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    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. This field or auto_increment_version should be set.
    autoIncrementVersion Boolean
    Whether the role version should be incremented automatically on updates (and set to 1 on creation). This field or version should be set.
    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
    orgId String
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    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. This field or auto_increment_version should be set.

    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,
            auto_increment_version: Optional[bool] = 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,
            org_id: 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:
    AutoIncrementVersion bool
    Whether the role version should be incremented automatically on updates (and set to 1 on creation). This field or version should be set.
    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
    OrgId string
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    Permissions List<Pulumiverse.Grafana.Inputs.RolePermission>
    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. This field or auto_increment_version should be set.
    AutoIncrementVersion bool
    Whether the role version should be incremented automatically on updates (and set to 1 on creation). This field or version should be set.
    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
    OrgId string
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    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. This field or auto_increment_version should be set.
    autoIncrementVersion Boolean
    Whether the role version should be incremented automatically on updates (and set to 1 on creation). This field or version should be set.
    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
    orgId String
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    permissions List<RolePermission>
    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. This field or auto_increment_version should be set.
    autoIncrementVersion boolean
    Whether the role version should be incremented automatically on updates (and set to 1 on creation). This field or version should be set.
    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
    orgId string
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    permissions RolePermission[]
    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. This field or auto_increment_version should be set.
    auto_increment_version bool
    Whether the role version should be incremented automatically on updates (and set to 1 on creation). This field or version should be set.
    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
    org_id str
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    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. This field or auto_increment_version should be set.
    autoIncrementVersion Boolean
    Whether the role version should be incremented automatically on updates (and set to 1 on creation). This field or version should be set.
    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
    orgId String
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    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. This field or auto_increment_version should be set.

    Supporting Types

    RolePermission, RolePermissionArgs

    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 name "{{ uid }}"
    
    $ pulumi import grafana:index/role:Role 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.7.0 published on Tuesday, Nov 5, 2024 by pulumiverse