1. Packages
  2. Grafana Cloud
  3. API Docs
  4. Folder
Grafana v0.16.3 published on Monday, Apr 7, 2025 by pulumiverse

grafana.Folder

Explore with Pulumi AI

Deprecated: grafana.index/folder.Folder has been deprecated in favor of grafana.oss/folder.Folder

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as grafana from "@pulumiverse/grafana";

const testFolder = new grafana.oss.Folder("test_folder", {title: "Terraform Test Folder"});
const testFolderDashboard = new grafana.oss.Dashboard("test_folder", {
    folder: testFolder.id,
    configJson: `{
  "title": "Dashboard in folder",
  "uid": "dashboard-in-folder"
}
`,
});
const testFolderWithUid = new grafana.oss.Folder("test_folder_with_uid", {
    uid: "test-folder-uid",
    title: "Terraform Test Folder With UID",
});
Copy
import pulumi
import pulumiverse_grafana as grafana

test_folder = grafana.oss.Folder("test_folder", title="Terraform Test Folder")
test_folder_dashboard = grafana.oss.Dashboard("test_folder",
    folder=test_folder.id,
    config_json="""{
  "title": "Dashboard in folder",
  "uid": "dashboard-in-folder"
}
""")
test_folder_with_uid = grafana.oss.Folder("test_folder_with_uid",
    uid="test-folder-uid",
    title="Terraform Test Folder With UID")
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 {
		testFolder, err := oss.NewFolder(ctx, "test_folder", &oss.FolderArgs{
			Title: pulumi.String("Terraform Test Folder"),
		})
		if err != nil {
			return err
		}
		_, err = oss.NewDashboard(ctx, "test_folder", &oss.DashboardArgs{
			Folder:     testFolder.ID(),
			ConfigJson: pulumi.String("{\n  \"title\": \"Dashboard in folder\",\n  \"uid\": \"dashboard-in-folder\"\n}\n"),
		})
		if err != nil {
			return err
		}
		_, err = oss.NewFolder(ctx, "test_folder_with_uid", &oss.FolderArgs{
			Uid:   pulumi.String("test-folder-uid"),
			Title: pulumi.String("Terraform Test Folder With UID"),
		})
		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 testFolder = new Grafana.Oss.Folder("test_folder", new()
    {
        Title = "Terraform Test Folder",
    });

    var testFolderDashboard = new Grafana.Oss.Dashboard("test_folder", new()
    {
        Folder = testFolder.Id,
        ConfigJson = @"{
  ""title"": ""Dashboard in folder"",
  ""uid"": ""dashboard-in-folder""
}
",
    });

    var testFolderWithUid = new Grafana.Oss.Folder("test_folder_with_uid", new()
    {
        Uid = "test-folder-uid",
        Title = "Terraform Test Folder With UID",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.grafana.oss.Folder;
import com.pulumi.grafana.oss.FolderArgs;
import com.pulumi.grafana.oss.Dashboard;
import com.pulumi.grafana.oss.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 testFolder = new Folder("testFolder", FolderArgs.builder()
            .title("Terraform Test Folder")
            .build());

        var testFolderDashboard = new Dashboard("testFolderDashboard", DashboardArgs.builder()
            .folder(testFolder.id())
            .configJson("""
{
  "title": "Dashboard in folder",
  "uid": "dashboard-in-folder"
}
            """)
            .build());

        var testFolderWithUid = new Folder("testFolderWithUid", FolderArgs.builder()
            .uid("test-folder-uid")
            .title("Terraform Test Folder With UID")
            .build());

    }
}
Copy
resources:
  testFolder:
    type: grafana:oss:Folder
    name: test_folder
    properties:
      title: Terraform Test Folder
  testFolderDashboard:
    type: grafana:oss:Dashboard
    name: test_folder
    properties:
      folder: ${testFolder.id}
      configJson: |
        {
          "title": "Dashboard in folder",
          "uid": "dashboard-in-folder"
        }        
  testFolderWithUid:
    type: grafana:oss:Folder
    name: test_folder_with_uid
    properties:
      uid: test-folder-uid
      title: Terraform Test Folder With UID
Copy

Create Folder Resource

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

Constructor syntax

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

@overload
def Folder(resource_name: str,
           opts: Optional[ResourceOptions] = None,
           org_id: Optional[str] = None,
           parent_folder_uid: Optional[str] = None,
           prevent_destroy_if_not_empty: Optional[bool] = None,
           title: Optional[str] = None,
           uid: Optional[str] = None)
func NewFolder(ctx *Context, name string, args FolderArgs, opts ...ResourceOption) (*Folder, error)
public Folder(string name, FolderArgs args, CustomResourceOptions? opts = null)
public Folder(String name, FolderArgs args)
public Folder(String name, FolderArgs args, CustomResourceOptions options)
type: grafana:Folder
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. FolderArgs
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. FolderArgs
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. FolderArgs
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. FolderArgs
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. FolderArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

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

Title This property is required. string
The title 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.
ParentFolderUid Changes to this property will trigger replacement. string
The uid of the parent folder. If set, the folder will be nested. If not set, the folder will be created in the root folder. Note: This requires the nestedFolders feature flag to be enabled on your Grafana instance.
PreventDestroyIfNotEmpty bool
Prevent deletion of the folder if it is not empty (contains dashboards or alert rules). This feature requires Grafana 10.2 or later. Defaults to false.
Uid Changes to this property will trigger replacement. string
Unique identifier.
Title This property is required. string
The title 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.
ParentFolderUid Changes to this property will trigger replacement. string
The uid of the parent folder. If set, the folder will be nested. If not set, the folder will be created in the root folder. Note: This requires the nestedFolders feature flag to be enabled on your Grafana instance.
PreventDestroyIfNotEmpty bool
Prevent deletion of the folder if it is not empty (contains dashboards or alert rules). This feature requires Grafana 10.2 or later. Defaults to false.
Uid Changes to this property will trigger replacement. string
Unique identifier.
title This property is required. String
The title 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.
parentFolderUid Changes to this property will trigger replacement. String
The uid of the parent folder. If set, the folder will be nested. If not set, the folder will be created in the root folder. Note: This requires the nestedFolders feature flag to be enabled on your Grafana instance.
preventDestroyIfNotEmpty Boolean
Prevent deletion of the folder if it is not empty (contains dashboards or alert rules). This feature requires Grafana 10.2 or later. Defaults to false.
uid Changes to this property will trigger replacement. String
Unique identifier.
title This property is required. string
The title 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.
parentFolderUid Changes to this property will trigger replacement. string
The uid of the parent folder. If set, the folder will be nested. If not set, the folder will be created in the root folder. Note: This requires the nestedFolders feature flag to be enabled on your Grafana instance.
preventDestroyIfNotEmpty boolean
Prevent deletion of the folder if it is not empty (contains dashboards or alert rules). This feature requires Grafana 10.2 or later. Defaults to false.
uid Changes to this property will trigger replacement. string
Unique identifier.
title This property is required. str
The title 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.
parent_folder_uid Changes to this property will trigger replacement. str
The uid of the parent folder. If set, the folder will be nested. If not set, the folder will be created in the root folder. Note: This requires the nestedFolders feature flag to be enabled on your Grafana instance.
prevent_destroy_if_not_empty bool
Prevent deletion of the folder if it is not empty (contains dashboards or alert rules). This feature requires Grafana 10.2 or later. Defaults to false.
uid Changes to this property will trigger replacement. str
Unique identifier.
title This property is required. String
The title 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.
parentFolderUid Changes to this property will trigger replacement. String
The uid of the parent folder. If set, the folder will be nested. If not set, the folder will be created in the root folder. Note: This requires the nestedFolders feature flag to be enabled on your Grafana instance.
preventDestroyIfNotEmpty Boolean
Prevent deletion of the folder if it is not empty (contains dashboards or alert rules). This feature requires Grafana 10.2 or later. Defaults to false.
uid Changes to this property will trigger replacement. String
Unique identifier.

Outputs

All input properties are implicitly available as output properties. Additionally, the Folder resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Url string
The full URL of the folder.
Id string
The provider-assigned unique ID for this managed resource.
Url string
The full URL of the folder.
id String
The provider-assigned unique ID for this managed resource.
url String
The full URL of the folder.
id string
The provider-assigned unique ID for this managed resource.
url string
The full URL of the folder.
id str
The provider-assigned unique ID for this managed resource.
url str
The full URL of the folder.
id String
The provider-assigned unique ID for this managed resource.
url String
The full URL of the folder.

Look up Existing Folder Resource

Get an existing Folder 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?: FolderState, opts?: CustomResourceOptions): Folder
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        org_id: Optional[str] = None,
        parent_folder_uid: Optional[str] = None,
        prevent_destroy_if_not_empty: Optional[bool] = None,
        title: Optional[str] = None,
        uid: Optional[str] = None,
        url: Optional[str] = None) -> Folder
func GetFolder(ctx *Context, name string, id IDInput, state *FolderState, opts ...ResourceOption) (*Folder, error)
public static Folder Get(string name, Input<string> id, FolderState? state, CustomResourceOptions? opts = null)
public static Folder get(String name, Output<String> id, FolderState state, CustomResourceOptions options)
resources:  _:    type: grafana:Folder    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:
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.
ParentFolderUid Changes to this property will trigger replacement. string
The uid of the parent folder. If set, the folder will be nested. If not set, the folder will be created in the root folder. Note: This requires the nestedFolders feature flag to be enabled on your Grafana instance.
PreventDestroyIfNotEmpty bool
Prevent deletion of the folder if it is not empty (contains dashboards or alert rules). This feature requires Grafana 10.2 or later. Defaults to false.
Title string
The title of the folder.
Uid Changes to this property will trigger replacement. string
Unique identifier.
Url string
The full URL 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.
ParentFolderUid Changes to this property will trigger replacement. string
The uid of the parent folder. If set, the folder will be nested. If not set, the folder will be created in the root folder. Note: This requires the nestedFolders feature flag to be enabled on your Grafana instance.
PreventDestroyIfNotEmpty bool
Prevent deletion of the folder if it is not empty (contains dashboards or alert rules). This feature requires Grafana 10.2 or later. Defaults to false.
Title string
The title of the folder.
Uid Changes to this property will trigger replacement. string
Unique identifier.
Url string
The full URL 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.
parentFolderUid Changes to this property will trigger replacement. String
The uid of the parent folder. If set, the folder will be nested. If not set, the folder will be created in the root folder. Note: This requires the nestedFolders feature flag to be enabled on your Grafana instance.
preventDestroyIfNotEmpty Boolean
Prevent deletion of the folder if it is not empty (contains dashboards or alert rules). This feature requires Grafana 10.2 or later. Defaults to false.
title String
The title of the folder.
uid Changes to this property will trigger replacement. String
Unique identifier.
url String
The full URL 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.
parentFolderUid Changes to this property will trigger replacement. string
The uid of the parent folder. If set, the folder will be nested. If not set, the folder will be created in the root folder. Note: This requires the nestedFolders feature flag to be enabled on your Grafana instance.
preventDestroyIfNotEmpty boolean
Prevent deletion of the folder if it is not empty (contains dashboards or alert rules). This feature requires Grafana 10.2 or later. Defaults to false.
title string
The title of the folder.
uid Changes to this property will trigger replacement. string
Unique identifier.
url string
The full URL 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.
parent_folder_uid Changes to this property will trigger replacement. str
The uid of the parent folder. If set, the folder will be nested. If not set, the folder will be created in the root folder. Note: This requires the nestedFolders feature flag to be enabled on your Grafana instance.
prevent_destroy_if_not_empty bool
Prevent deletion of the folder if it is not empty (contains dashboards or alert rules). This feature requires Grafana 10.2 or later. Defaults to false.
title str
The title of the folder.
uid Changes to this property will trigger replacement. str
Unique identifier.
url str
The full URL 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.
parentFolderUid Changes to this property will trigger replacement. String
The uid of the parent folder. If set, the folder will be nested. If not set, the folder will be created in the root folder. Note: This requires the nestedFolders feature flag to be enabled on your Grafana instance.
preventDestroyIfNotEmpty Boolean
Prevent deletion of the folder if it is not empty (contains dashboards or alert rules). This feature requires Grafana 10.2 or later. Defaults to false.
title String
The title of the folder.
uid Changes to this property will trigger replacement. String
Unique identifier.
url String
The full URL of the folder.

Import

$ pulumi import grafana:index/folder:Folder name "{{ uid }}"
Copy
$ pulumi import grafana:index/folder:Folder name "{{ orgID }}:{{ uid }}"
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.