Skip to content

[FEAT] Folder resource and data source #379

@brad-cooley

Description

@brad-cooley

🚀 Feature description

When creating and managing Fabric workspaces with Terraform, I want to programmatically create, organize, and update folders using a Terraform configuration to automate and scale the management of structured resource hierarchies and ensure consistent deployments.

🔈 Motivation

The current lack of support for a folder resource limits the ability to manage organizational structure within workspaces. This gap forces users to manually create and maintain folders outside of Infrastructure-as-Code practices, which introduces inconsistencies, delays, and errors in deployment pipelines.

🛰 Alternatives

With the release of the Folder REST API in preview, this endpoint can be called using some script (Python, PowerShell, etc.) coupled with a null_resource. This isn't ideal as errors aren't handled as eloquently as native resources.

🚧 Potential Configuration / Desired Solution

# Resource
resource "fabric_folder" "example_folder" {
  display_name = "Example Folder"
  workspace_id = "workspace-id"
}

# Resource with a parent_id, indicating that it is a subfolder.
resource "fabric_folder" "example_subfolder" {
  display_name = "Example Folder"
  parent_id    = "parent-folder-id"
  workspace_id = "workspace-id"
}

# Data Source example to fetch existing folder information
data "fabric_folder" "existing_folder" {
  id    = "existing-folder-id"
  workspace_id = "workspace-id"
}

📎 Additional context

Ideally, this enables the ability for any WorkspaceItem to have a folder_id property where an item can be created inside of a folder (this supposedly is now available in the item API).

☑️ Acceptance Criteria

Folder Resource Support

  • Users can define a fabric_folder resource with required properties:
    • display_name
    • parent_id (optional for root-level folders)
    • workspace_id
  • Applying a plan creates the folder in the specified workspace.
  • Updating the display_name or parent_id updates the folder in place (when allowed by the API).
  • Destroying the resource deletes the folder from the workspace (assuming it contains no child resources or Terraform can handle dependencies appropriately).

Folder Data Source Support

  • Terraform users can declare a data fabric_folder block to retrieve folder metadata using folder_id and workspace_id.
  • The data source returns folder properties, including:
    • display_name
    • id
    • parent_id
    • workspace_id

Edge Case Handling

  • The provider validates the folder hierarchy (e.g., prevents circular nesting if applicable).
  • Nested folder creation is supported via parent-child relationships.

🔰 Code of Conduct

  • I agree to follow this project's Code of Conduct.

Metadata

Metadata

Assignees

Labels

featureNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions