prefect 2.26.1 published on Friday, May 9, 2025 by prefecthq
prefect.getWorkspaceRole
Explore with Pulumi AI
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): Prefect Cloud (Pro), Prefect Cloud (Enterprise).
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as prefect from "@pulumi/prefect";
const owner = prefect.getWorkspaceRole({
    name: "Owner",
});
const worker = prefect.getWorkspaceRole({
    name: "Worker",
});
const developer = prefect.getWorkspaceRole({
    name: "Developer",
});
const viewer = prefect.getWorkspaceRole({
    name: "Viewer",
});
const runner = prefect.getWorkspaceRole({
    name: "Runner",
});
import pulumi
import pulumi_prefect as prefect
owner = prefect.get_workspace_role(name="Owner")
worker = prefect.get_workspace_role(name="Worker")
developer = prefect.get_workspace_role(name="Developer")
viewer = prefect.get_workspace_role(name="Viewer")
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 {
		_, err := prefect.LookupWorkspaceRole(ctx, &prefect.LookupWorkspaceRoleArgs{
			Name: "Owner",
		}, nil)
		if err != nil {
			return err
		}
		_, err = prefect.LookupWorkspaceRole(ctx, &prefect.LookupWorkspaceRoleArgs{
			Name: "Worker",
		}, nil)
		if err != nil {
			return err
		}
		_, err = prefect.LookupWorkspaceRole(ctx, &prefect.LookupWorkspaceRoleArgs{
			Name: "Developer",
		}, nil)
		if err != nil {
			return err
		}
		_, err = prefect.LookupWorkspaceRole(ctx, &prefect.LookupWorkspaceRoleArgs{
			Name: "Viewer",
		}, nil)
		if err != nil {
			return err
		}
		_, 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(() => 
{
    var owner = Prefect.GetWorkspaceRole.Invoke(new()
    {
        Name = "Owner",
    });
    var worker = Prefect.GetWorkspaceRole.Invoke(new()
    {
        Name = "Worker",
    });
    var developer = Prefect.GetWorkspaceRole.Invoke(new()
    {
        Name = "Developer",
    });
    var viewer = Prefect.GetWorkspaceRole.Invoke(new()
    {
        Name = "Viewer",
    });
    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) {
        final var owner = PrefectFunctions.getWorkspaceRole(GetWorkspaceRoleArgs.builder()
            .name("Owner")
            .build());
        final var worker = PrefectFunctions.getWorkspaceRole(GetWorkspaceRoleArgs.builder()
            .name("Worker")
            .build());
        final var developer = PrefectFunctions.getWorkspaceRole(GetWorkspaceRoleArgs.builder()
            .name("Developer")
            .build());
        final var viewer = PrefectFunctions.getWorkspaceRole(GetWorkspaceRoleArgs.builder()
            .name("Viewer")
            .build());
        final var runner = PrefectFunctions.getWorkspaceRole(GetWorkspaceRoleArgs.builder()
            .name("Runner")
            .build());
    }
}
variables:
  owner:
    fn::invoke:
      function: prefect:getWorkspaceRole
      arguments:
        name: Owner
  worker:
    fn::invoke:
      function: prefect:getWorkspaceRole
      arguments:
        name: Worker
  developer:
    fn::invoke:
      function: prefect:getWorkspaceRole
      arguments:
        name: Developer
  viewer:
    fn::invoke:
      function: prefect:getWorkspaceRole
      arguments:
        name: Viewer
  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 dictionaryThe following arguments are supported:
- name str
- Name of the Workspace Role
- account_id str
- 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)
- InheritedRole stringId 
- 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)
- InheritedRole stringId 
- 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)
- inheritedRole StringId 
- 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)
- inheritedRole stringId 
- 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_ strid 
- 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)
- inheritedRole StringId 
- 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 prefectTerraform Provider.