1. Packages
  2. Prefect Provider
  3. API Docs
  4. getWorkspaceRole
prefect 2.90.1 published on Friday, Nov 14, 2025 by prefecthq
prefect logo
prefect 2.90.1 published on Friday, Nov 14, 2025 by prefecthq

    Get information about an existing Workspace Role.
    Use this data source read down the pre-defined Roles, to manage User and Service Account access.
    For more information, see manage workspaces.

    This feature is available in the following product plan(s): Pro, Enterprise.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as prefect from "@pulumi/prefect";
    
    // Read down the default Owner Workspace Role
    const owner = prefect.getWorkspaceRole({
        name: "Owner",
    });
    // Read down the default Worker Workspace Role
    const worker = prefect.getWorkspaceRole({
        name: "Worker",
    });
    // Read down the default Developer Workspace Role
    const developer = prefect.getWorkspaceRole({
        name: "Developer",
    });
    // Read down the default Viewer Workspace Role
    const viewer = prefect.getWorkspaceRole({
        name: "Viewer",
    });
    // Read down the default Runner Workspace Role
    const runner = prefect.getWorkspaceRole({
        name: "Runner",
    });
    
    import pulumi
    import pulumi_prefect as prefect
    
    # Read down the default Owner Workspace Role
    owner = prefect.get_workspace_role(name="Owner")
    # Read down the default Worker Workspace Role
    worker = prefect.get_workspace_role(name="Worker")
    # Read down the default Developer Workspace Role
    developer = prefect.get_workspace_role(name="Developer")
    # Read down the default Viewer Workspace Role
    viewer = prefect.get_workspace_role(name="Viewer")
    # Read down the default Runner Workspace Role
    runner = prefect.get_workspace_role(name="Runner")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/prefect/v2/prefect"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		// Read down the default Owner Workspace Role
    		_, err := prefect.LookupWorkspaceRole(ctx, &prefect.LookupWorkspaceRoleArgs{
    			Name: "Owner",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		// Read down the default Worker Workspace Role
    		_, err = prefect.LookupWorkspaceRole(ctx, &prefect.LookupWorkspaceRoleArgs{
    			Name: "Worker",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		// Read down the default Developer Workspace Role
    		_, err = prefect.LookupWorkspaceRole(ctx, &prefect.LookupWorkspaceRoleArgs{
    			Name: "Developer",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		// Read down the default Viewer Workspace Role
    		_, err = prefect.LookupWorkspaceRole(ctx, &prefect.LookupWorkspaceRoleArgs{
    			Name: "Viewer",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		// Read down the default Runner Workspace Role
    		_, err = prefect.LookupWorkspaceRole(ctx, &prefect.LookupWorkspaceRoleArgs{
    			Name: "Runner",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Prefect = Pulumi.Prefect;
    
    return await Deployment.RunAsync(() => 
    {
        // Read down the default Owner Workspace Role
        var owner = Prefect.GetWorkspaceRole.Invoke(new()
        {
            Name = "Owner",
        });
    
        // Read down the default Worker Workspace Role
        var worker = Prefect.GetWorkspaceRole.Invoke(new()
        {
            Name = "Worker",
        });
    
        // Read down the default Developer Workspace Role
        var developer = Prefect.GetWorkspaceRole.Invoke(new()
        {
            Name = "Developer",
        });
    
        // Read down the default Viewer Workspace Role
        var viewer = Prefect.GetWorkspaceRole.Invoke(new()
        {
            Name = "Viewer",
        });
    
        // Read down the default Runner Workspace Role
        var runner = Prefect.GetWorkspaceRole.Invoke(new()
        {
            Name = "Runner",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.prefect.PrefectFunctions;
    import com.pulumi.prefect.inputs.GetWorkspaceRoleArgs;
    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) {
            // Read down the default Owner Workspace Role
            final var owner = PrefectFunctions.getWorkspaceRole(GetWorkspaceRoleArgs.builder()
                .name("Owner")
                .build());
    
            // Read down the default Worker Workspace Role
            final var worker = PrefectFunctions.getWorkspaceRole(GetWorkspaceRoleArgs.builder()
                .name("Worker")
                .build());
    
            // Read down the default Developer Workspace Role
            final var developer = PrefectFunctions.getWorkspaceRole(GetWorkspaceRoleArgs.builder()
                .name("Developer")
                .build());
    
            // Read down the default Viewer Workspace Role
            final var viewer = PrefectFunctions.getWorkspaceRole(GetWorkspaceRoleArgs.builder()
                .name("Viewer")
                .build());
    
            // Read down the default Runner Workspace Role
            final var runner = PrefectFunctions.getWorkspaceRole(GetWorkspaceRoleArgs.builder()
                .name("Runner")
                .build());
    
        }
    }
    
    variables:
      # Read down the default Owner Workspace Role
      owner:
        fn::invoke:
          function: prefect:getWorkspaceRole
          arguments:
            name: Owner
      # Read down the default Worker Workspace Role
      worker:
        fn::invoke:
          function: prefect:getWorkspaceRole
          arguments:
            name: Worker
      # Read down the default Developer Workspace Role
      developer:
        fn::invoke:
          function: prefect:getWorkspaceRole
          arguments:
            name: Developer
      # Read down the default Viewer Workspace Role
      viewer:
        fn::invoke:
          function: prefect:getWorkspaceRole
          arguments:
            name: Viewer
      # Read down the default Runner Workspace Role
      runner:
        fn::invoke:
          function: prefect:getWorkspaceRole
          arguments:
            name: Runner
    

    Using getWorkspaceRole

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getWorkspaceRole(args: GetWorkspaceRoleArgs, opts?: InvokeOptions): Promise<GetWorkspaceRoleResult>
    function getWorkspaceRoleOutput(args: GetWorkspaceRoleOutputArgs, opts?: InvokeOptions): Output<GetWorkspaceRoleResult>
    def get_workspace_role(account_id: Optional[str] = None,
                           name: Optional[str] = None,
                           opts: Optional[InvokeOptions] = None) -> GetWorkspaceRoleResult
    def get_workspace_role_output(account_id: Optional[pulumi.Input[str]] = None,
                           name: Optional[pulumi.Input[str]] = None,
                           opts: Optional[InvokeOptions] = None) -> Output[GetWorkspaceRoleResult]
    func LookupWorkspaceRole(ctx *Context, args *LookupWorkspaceRoleArgs, opts ...InvokeOption) (*LookupWorkspaceRoleResult, error)
    func LookupWorkspaceRoleOutput(ctx *Context, args *LookupWorkspaceRoleOutputArgs, opts ...InvokeOption) LookupWorkspaceRoleResultOutput

    > Note: This function is named LookupWorkspaceRole in the Go SDK.

    public static class GetWorkspaceRole 
    {
        public static Task<GetWorkspaceRoleResult> InvokeAsync(GetWorkspaceRoleArgs args, InvokeOptions? opts = null)
        public static Output<GetWorkspaceRoleResult> Invoke(GetWorkspaceRoleInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetWorkspaceRoleResult> getWorkspaceRole(GetWorkspaceRoleArgs args, InvokeOptions options)
    public static Output<GetWorkspaceRoleResult> getWorkspaceRole(GetWorkspaceRoleArgs args, InvokeOptions options)
    
    fn::invoke:
      function: prefect:index/getWorkspaceRole:getWorkspaceRole
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Name string
    Name of the Workspace Role
    AccountId string
    Account ID (UUID) where Workspace Role resides
    Name string
    Name of the Workspace Role
    AccountId string
    Account ID (UUID) where Workspace Role resides
    name String
    Name of the Workspace Role
    accountId String
    Account ID (UUID) where Workspace Role resides
    name string
    Name of the Workspace Role
    accountId string
    Account ID (UUID) where Workspace Role resides
    name str
    Name of the Workspace Role
    account_id str
    Account ID (UUID) where Workspace Role resides
    name String
    Name of the Workspace Role
    accountId String
    Account ID (UUID) where Workspace Role resides

    getWorkspaceRole Result

    The following output properties are available:

    Created string
    Timestamp of when the resource was created (RFC3339)
    Description string
    Description of the Workspace Role
    Id string
    Workspace Role ID (UUID)
    InheritedRoleId string
    Workspace Role ID (UUID), whose permissions are inherited by this Workspace Role
    Name string
    Name of the Workspace Role
    Scopes List<string>
    List of scopes linked to the Workspace Role
    Updated string
    Timestamp of when the resource was updated (RFC3339)
    AccountId string
    Account ID (UUID) where Workspace Role resides
    Created string
    Timestamp of when the resource was created (RFC3339)
    Description string
    Description of the Workspace Role
    Id string
    Workspace Role ID (UUID)
    InheritedRoleId string
    Workspace Role ID (UUID), whose permissions are inherited by this Workspace Role
    Name string
    Name of the Workspace Role
    Scopes []string
    List of scopes linked to the Workspace Role
    Updated string
    Timestamp of when the resource was updated (RFC3339)
    AccountId string
    Account ID (UUID) where Workspace Role resides
    created String
    Timestamp of when the resource was created (RFC3339)
    description String
    Description of the Workspace Role
    id String
    Workspace Role ID (UUID)
    inheritedRoleId String
    Workspace Role ID (UUID), whose permissions are inherited by this Workspace Role
    name String
    Name of the Workspace Role
    scopes List<String>
    List of scopes linked to the Workspace Role
    updated String
    Timestamp of when the resource was updated (RFC3339)
    accountId String
    Account ID (UUID) where Workspace Role resides
    created string
    Timestamp of when the resource was created (RFC3339)
    description string
    Description of the Workspace Role
    id string
    Workspace Role ID (UUID)
    inheritedRoleId string
    Workspace Role ID (UUID), whose permissions are inherited by this Workspace Role
    name string
    Name of the Workspace Role
    scopes string[]
    List of scopes linked to the Workspace Role
    updated string
    Timestamp of when the resource was updated (RFC3339)
    accountId string
    Account ID (UUID) where Workspace Role resides
    created str
    Timestamp of when the resource was created (RFC3339)
    description str
    Description of the Workspace Role
    id str
    Workspace Role ID (UUID)
    inherited_role_id str
    Workspace Role ID (UUID), whose permissions are inherited by this Workspace Role
    name str
    Name of the Workspace Role
    scopes Sequence[str]
    List of scopes linked to the Workspace Role
    updated str
    Timestamp of when the resource was updated (RFC3339)
    account_id str
    Account ID (UUID) where Workspace Role resides
    created String
    Timestamp of when the resource was created (RFC3339)
    description String
    Description of the Workspace Role
    id String
    Workspace Role ID (UUID)
    inheritedRoleId String
    Workspace Role ID (UUID), whose permissions are inherited by this Workspace Role
    name String
    Name of the Workspace Role
    scopes List<String>
    List of scopes linked to the Workspace Role
    updated String
    Timestamp of when the resource was updated (RFC3339)
    accountId String
    Account ID (UUID) where Workspace Role resides

    Package Details

    Repository
    prefect prefecthq/terraform-provider-prefect
    License
    Notes
    This Pulumi package is based on the prefect Terraform Provider.
    prefect logo
    prefect 2.90.1 published on Friday, Nov 14, 2025 by prefecthq
      Meet Neo: Your AI Platform Teammate