1. Packages
  2. Grafana Cloud
  3. API Docs
  4. FolderPermission
Grafana v0.16.1 published on Saturday, Mar 15, 2025 by pulumiverse

grafana.FolderPermission

Explore with Pulumi AI

Deprecated: grafana.index/folderpermission.FolderPermission has been deprecated in favor of grafana.oss/folderpermission.FolderPermission

Manages the entire set of permissions for a folder. Permissions that aren’t specified when applying this resource will be removed.

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",
    login: "user.name",
    password: "my-password",
});
const collection = new grafana.oss.Folder("collection", {title: "Folder Title"});
const collectionPermission = new grafana.oss.FolderPermission("collectionPermission", {
    folderUid: collection.uid,
    permissions: [
        {
            role: "Editor",
            permission: "Edit",
        },
        {
            teamId: team.id,
            permission: "View",
        },
        {
            userId: user.id,
            permission: "Admin",
        },
    ],
});
Copy
import pulumi
import pulumiverse_grafana as grafana

team = grafana.oss.Team("team", name="Team Name")
user = grafana.oss.User("user",
    email="user.name@example.com",
    login="user.name",
    password="my-password")
collection = grafana.oss.Folder("collection", title="Folder Title")
collection_permission = grafana.oss.FolderPermission("collectionPermission",
    folder_uid=collection.uid,
    permissions=[
        {
            "role": "Editor",
            "permission": "Edit",
        },
        {
            "team_id": team.id,
            "permission": "View",
        },
        {
            "user_id": user.id,
            "permission": "Admin",
        },
    ])
Copy
package main

import (
	"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"),
			Login:    pulumi.String("user.name"),
			Password: pulumi.String("my-password"),
		})
		if err != nil {
			return err
		}
		collection, err := oss.NewFolder(ctx, "collection", &oss.FolderArgs{
			Title: pulumi.String("Folder Title"),
		})
		if err != nil {
			return err
		}
		_, err = oss.NewFolderPermission(ctx, "collectionPermission", &oss.FolderPermissionArgs{
			FolderUid: collection.Uid,
			Permissions: oss.FolderPermissionPermissionArray{
				&oss.FolderPermissionPermissionArgs{
					Role:       pulumi.String("Editor"),
					Permission: pulumi.String("Edit"),
				},
				&oss.FolderPermissionPermissionArgs{
					TeamId:     team.ID(),
					Permission: pulumi.String("View"),
				},
				&oss.FolderPermissionPermissionArgs{
					UserId:     user.ID(),
					Permission: pulumi.String("Admin"),
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
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",
        Login = "user.name",
        Password = "my-password",
    });

    var collection = new Grafana.Oss.Folder("collection", new()
    {
        Title = "Folder Title",
    });

    var collectionPermission = new Grafana.Oss.FolderPermission("collectionPermission", new()
    {
        FolderUid = collection.Uid,
        Permissions = new[]
        {
            new Grafana.Oss.Inputs.FolderPermissionPermissionArgs
            {
                Role = "Editor",
                Permission = "Edit",
            },
            new Grafana.Oss.Inputs.FolderPermissionPermissionArgs
            {
                TeamId = team.Id,
                Permission = "View",
            },
            new Grafana.Oss.Inputs.FolderPermissionPermissionArgs
            {
                UserId = user.Id,
                Permission = "Admin",
            },
        },
    });

});
Copy
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.Folder;
import com.pulumi.grafana.oss.FolderArgs;
import com.pulumi.grafana.oss.FolderPermission;
import com.pulumi.grafana.oss.FolderPermissionArgs;
import com.pulumi.grafana.oss.inputs.FolderPermissionPermissionArgs;
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")
            .login("user.name")
            .password("my-password")
            .build());

        var collection = new Folder("collection", FolderArgs.builder()
            .title("Folder Title")
            .build());

        var collectionPermission = new FolderPermission("collectionPermission", FolderPermissionArgs.builder()
            .folderUid(collection.uid())
            .permissions(            
                FolderPermissionPermissionArgs.builder()
                    .role("Editor")
                    .permission("Edit")
                    .build(),
                FolderPermissionPermissionArgs.builder()
                    .teamId(team.id())
                    .permission("View")
                    .build(),
                FolderPermissionPermissionArgs.builder()
                    .userId(user.id())
                    .permission("Admin")
                    .build())
            .build());

    }
}
Copy
resources:
  team:
    type: grafana:oss:Team
    properties:
      name: Team Name
  user:
    type: grafana:oss:User
    properties:
      email: user.name@example.com
      login: user.name
      password: my-password
  collection:
    type: grafana:oss:Folder
    properties:
      title: Folder Title
  collectionPermission:
    type: grafana:oss:FolderPermission
    properties:
      folderUid: ${collection.uid}
      permissions:
        - role: Editor
          permission: Edit
        - teamId: ${team.id}
          permission: View
        - userId: ${user.id}
          permission: Admin
Copy

Create FolderPermission Resource

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

Constructor syntax

new FolderPermission(name: string, args: FolderPermissionArgs, opts?: CustomResourceOptions);
@overload
def FolderPermission(resource_name: str,
                     args: FolderPermissionArgs,
                     opts: Optional[ResourceOptions] = None)

@overload
def FolderPermission(resource_name: str,
                     opts: Optional[ResourceOptions] = None,
                     folder_uid: Optional[str] = None,
                     org_id: Optional[str] = None,
                     permissions: Optional[Sequence[FolderPermissionPermissionArgs]] = None)
func NewFolderPermission(ctx *Context, name string, args FolderPermissionArgs, opts ...ResourceOption) (*FolderPermission, error)
public FolderPermission(string name, FolderPermissionArgs args, CustomResourceOptions? opts = null)
public FolderPermission(String name, FolderPermissionArgs args)
public FolderPermission(String name, FolderPermissionArgs args, CustomResourceOptions options)
type: grafana:FolderPermission
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. FolderPermissionArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. FolderPermissionArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. FolderPermissionArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. FolderPermissionArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. FolderPermissionArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

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

FolderUid
This property is required.
Changes to this property will trigger replacement.
string
The UID of the folder.
OrgId Changes to this property will trigger replacement. string
The Organization ID. If not set, the Org ID defined in the provider block will be used.
Permissions List<Pulumiverse.Grafana.Inputs.FolderPermissionPermission>
The permission items to add/update. Items that are omitted from the list will be removed.
FolderUid
This property is required.
Changes to this property will trigger replacement.
string
The UID of the folder.
OrgId Changes to this property will trigger replacement. string
The Organization ID. If not set, the Org ID defined in the provider block will be used.
Permissions []FolderPermissionPermissionArgs
The permission items to add/update. Items that are omitted from the list will be removed.
folderUid
This property is required.
Changes to this property will trigger replacement.
String
The UID of the folder.
orgId Changes to this property will trigger replacement. String
The Organization ID. If not set, the Org ID defined in the provider block will be used.
permissions List<FolderPermissionPermission>
The permission items to add/update. Items that are omitted from the list will be removed.
folderUid
This property is required.
Changes to this property will trigger replacement.
string
The UID of the folder.
orgId Changes to this property will trigger replacement. string
The Organization ID. If not set, the Org ID defined in the provider block will be used.
permissions FolderPermissionPermission[]
The permission items to add/update. Items that are omitted from the list will be removed.
folder_uid
This property is required.
Changes to this property will trigger replacement.
str
The UID of the folder.
org_id Changes to this property will trigger replacement. str
The Organization ID. If not set, the Org ID defined in the provider block will be used.
permissions Sequence[FolderPermissionPermissionArgs]
The permission items to add/update. Items that are omitted from the list will be removed.
folderUid
This property is required.
Changes to this property will trigger replacement.
String
The UID of the folder.
orgId Changes to this property will trigger replacement. String
The Organization ID. If not set, the Org ID defined in the provider block will be used.
permissions List<Property Map>
The permission items to add/update. Items that are omitted from the list will be removed.

Outputs

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

Get an existing FolderPermission 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?: FolderPermissionState, opts?: CustomResourceOptions): FolderPermission
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        folder_uid: Optional[str] = None,
        org_id: Optional[str] = None,
        permissions: Optional[Sequence[FolderPermissionPermissionArgs]] = None) -> FolderPermission
func GetFolderPermission(ctx *Context, name string, id IDInput, state *FolderPermissionState, opts ...ResourceOption) (*FolderPermission, error)
public static FolderPermission Get(string name, Input<string> id, FolderPermissionState? state, CustomResourceOptions? opts = null)
public static FolderPermission get(String name, Output<String> id, FolderPermissionState state, CustomResourceOptions options)
resources:  _:    type: grafana:FolderPermission    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
FolderUid Changes to this property will trigger replacement. string
The UID of the folder.
OrgId Changes to this property will trigger replacement. string
The Organization ID. If not set, the Org ID defined in the provider block will be used.
Permissions List<Pulumiverse.Grafana.Inputs.FolderPermissionPermission>
The permission items to add/update. Items that are omitted from the list will be removed.
FolderUid Changes to this property will trigger replacement. string
The UID of the folder.
OrgId Changes to this property will trigger replacement. string
The Organization ID. If not set, the Org ID defined in the provider block will be used.
Permissions []FolderPermissionPermissionArgs
The permission items to add/update. Items that are omitted from the list will be removed.
folderUid Changes to this property will trigger replacement. String
The UID of the folder.
orgId Changes to this property will trigger replacement. String
The Organization ID. If not set, the Org ID defined in the provider block will be used.
permissions List<FolderPermissionPermission>
The permission items to add/update. Items that are omitted from the list will be removed.
folderUid Changes to this property will trigger replacement. string
The UID of the folder.
orgId Changes to this property will trigger replacement. string
The Organization ID. If not set, the Org ID defined in the provider block will be used.
permissions FolderPermissionPermission[]
The permission items to add/update. Items that are omitted from the list will be removed.
folder_uid Changes to this property will trigger replacement. str
The UID of the folder.
org_id Changes to this property will trigger replacement. str
The Organization ID. If not set, the Org ID defined in the provider block will be used.
permissions Sequence[FolderPermissionPermissionArgs]
The permission items to add/update. Items that are omitted from the list will be removed.
folderUid Changes to this property will trigger replacement. String
The UID of the folder.
orgId Changes to this property will trigger replacement. String
The Organization ID. If not set, the Org ID defined in the provider block will be used.
permissions List<Property Map>
The permission items to add/update. Items that are omitted from the list will be removed.

Supporting Types

FolderPermissionPermission
, FolderPermissionPermissionArgs

Permission This property is required. string
Permission to associate with item. Must be one of View, Edit, or Admin.
Role string
Name of the basic role to manage permissions for. Options: Viewer, Editor or Admin.
TeamId string
ID of the team to manage permissions for. Defaults to 0.
UserId string
ID of the user or service account to manage permissions for. Defaults to 0.
Permission This property is required. string
Permission to associate with item. Must be one of View, Edit, or Admin.
Role string
Name of the basic role to manage permissions for. Options: Viewer, Editor or Admin.
TeamId string
ID of the team to manage permissions for. Defaults to 0.
UserId string
ID of the user or service account to manage permissions for. Defaults to 0.
permission This property is required. String
Permission to associate with item. Must be one of View, Edit, or Admin.
role String
Name of the basic role to manage permissions for. Options: Viewer, Editor or Admin.
teamId String
ID of the team to manage permissions for. Defaults to 0.
userId String
ID of the user or service account to manage permissions for. Defaults to 0.
permission This property is required. string
Permission to associate with item. Must be one of View, Edit, or Admin.
role string
Name of the basic role to manage permissions for. Options: Viewer, Editor or Admin.
teamId string
ID of the team to manage permissions for. Defaults to 0.
userId string
ID of the user or service account to manage permissions for. Defaults to 0.
permission This property is required. str
Permission to associate with item. Must be one of View, Edit, or Admin.
role str
Name of the basic role to manage permissions for. Options: Viewer, Editor or Admin.
team_id str
ID of the team to manage permissions for. Defaults to 0.
user_id str
ID of the user or service account to manage permissions for. Defaults to 0.
permission This property is required. String
Permission to associate with item. Must be one of View, Edit, or Admin.
role String
Name of the basic role to manage permissions for. Options: Viewer, Editor or Admin.
teamId String
ID of the team to manage permissions for. Defaults to 0.
userId String
ID of the user or service account to manage permissions for. Defaults to 0.

Import

$ pulumi import grafana:index/folderPermission:FolderPermission name "{{ folderUID }}"
Copy
$ pulumi import grafana:index/folderPermission:FolderPermission name "{{ orgID }}:{{ folderUID }}"
Copy

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.