1. Packages
  2. Prefect Provider
  3. API Docs
  4. Workspace
prefect 2.24.1 published on Tuesday, Apr 15, 2025 by prefecthq

prefect.Workspace

Explore with Pulumi AI

The resource workspace represents a Prefect Cloud Workspace. Workspaces are discrete environments in Prefect Cloud for your flows, configurations, and deployments. Manage your workflows and RBAC policies using work_pool and workspace_access resources. For more information, see manage workspaces.

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

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as prefect from "@pulumi/prefect";

const example = new prefect.Workspace("example", {handle: "my-workspace"});
Copy
import pulumi
import pulumi_prefect as prefect

example = prefect.Workspace("example", handle="my-workspace")
Copy
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.NewWorkspace(ctx, "example", &prefect.WorkspaceArgs{
			Handle: pulumi.String("my-workspace"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Prefect = Pulumi.Prefect;

return await Deployment.RunAsync(() => 
{
    var example = new Prefect.Workspace("example", new()
    {
        Handle = "my-workspace",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.prefect.Workspace;
import com.pulumi.prefect.WorkspaceArgs;
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 example = new Workspace("example", WorkspaceArgs.builder()
            .handle("my-workspace")
            .build());

    }
}
Copy
resources:
  example:
    type: prefect:Workspace
    properties:
      handle: my-workspace
Copy

Create Workspace Resource

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

Constructor syntax

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

@overload
def Workspace(resource_name: str,
              opts: Optional[ResourceOptions] = None,
              handle: Optional[str] = None,
              account_id: Optional[str] = None,
              description: Optional[str] = None,
              name: Optional[str] = None)
func NewWorkspace(ctx *Context, name string, args WorkspaceArgs, opts ...ResourceOption) (*Workspace, error)
public Workspace(string name, WorkspaceArgs args, CustomResourceOptions? opts = null)
public Workspace(String name, WorkspaceArgs args)
public Workspace(String name, WorkspaceArgs args, CustomResourceOptions options)
type: prefect:Workspace
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. WorkspaceArgs
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. WorkspaceArgs
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. WorkspaceArgs
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. WorkspaceArgs
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. WorkspaceArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var workspaceResource = new Prefect.Workspace("workspaceResource", new()
{
    Handle = "string",
    AccountId = "string",
    Description = "string",
    Name = "string",
});
Copy
example, err := prefect.NewWorkspace(ctx, "workspaceResource", &prefect.WorkspaceArgs{
Handle: pulumi.String("string"),
AccountId: pulumi.String("string"),
Description: pulumi.String("string"),
Name: pulumi.String("string"),
})
Copy
var workspaceResource = new Workspace("workspaceResource", WorkspaceArgs.builder()
    .handle("string")
    .accountId("string")
    .description("string")
    .name("string")
    .build());
Copy
workspace_resource = prefect.Workspace("workspaceResource",
    handle="string",
    account_id="string",
    description="string",
    name="string")
Copy
const workspaceResource = new prefect.Workspace("workspaceResource", {
    handle: "string",
    accountId: "string",
    description: "string",
    name: "string",
});
Copy
type: prefect:Workspace
properties:
    accountId: string
    description: string
    handle: string
    name: string
Copy

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

Handle This property is required. string
Unique handle for the workspace
AccountId string
Account ID (UUID), defaults to the account set in the provider
Description string
Description for the workspace
Name string
Name of the workspace
Handle This property is required. string
Unique handle for the workspace
AccountId string
Account ID (UUID), defaults to the account set in the provider
Description string
Description for the workspace
Name string
Name of the workspace
handle This property is required. String
Unique handle for the workspace
accountId String
Account ID (UUID), defaults to the account set in the provider
description String
Description for the workspace
name String
Name of the workspace
handle This property is required. string
Unique handle for the workspace
accountId string
Account ID (UUID), defaults to the account set in the provider
description string
Description for the workspace
name string
Name of the workspace
handle This property is required. str
Unique handle for the workspace
account_id str
Account ID (UUID), defaults to the account set in the provider
description str
Description for the workspace
name str
Name of the workspace
handle This property is required. String
Unique handle for the workspace
accountId String
Account ID (UUID), defaults to the account set in the provider
description String
Description for the workspace
name String
Name of the workspace

Outputs

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

Created string
Timestamp of when the resource was created (RFC3339)
Id string
The provider-assigned unique ID for this managed resource.
Updated string
Timestamp of when the resource was updated (RFC3339)
Created string
Timestamp of when the resource was created (RFC3339)
Id string
The provider-assigned unique ID for this managed resource.
Updated string
Timestamp of when the resource was updated (RFC3339)
created String
Timestamp of when the resource was created (RFC3339)
id String
The provider-assigned unique ID for this managed resource.
updated String
Timestamp of when the resource was updated (RFC3339)
created string
Timestamp of when the resource was created (RFC3339)
id string
The provider-assigned unique ID for this managed resource.
updated string
Timestamp of when the resource was updated (RFC3339)
created str
Timestamp of when the resource was created (RFC3339)
id str
The provider-assigned unique ID for this managed resource.
updated str
Timestamp of when the resource was updated (RFC3339)
created String
Timestamp of when the resource was created (RFC3339)
id String
The provider-assigned unique ID for this managed resource.
updated String
Timestamp of when the resource was updated (RFC3339)

Look up Existing Workspace Resource

Get an existing Workspace 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?: WorkspaceState, opts?: CustomResourceOptions): Workspace
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        account_id: Optional[str] = None,
        created: Optional[str] = None,
        description: Optional[str] = None,
        handle: Optional[str] = None,
        name: Optional[str] = None,
        updated: Optional[str] = None) -> Workspace
func GetWorkspace(ctx *Context, name string, id IDInput, state *WorkspaceState, opts ...ResourceOption) (*Workspace, error)
public static Workspace Get(string name, Input<string> id, WorkspaceState? state, CustomResourceOptions? opts = null)
public static Workspace get(String name, Output<String> id, WorkspaceState state, CustomResourceOptions options)
resources:  _:    type: prefect:Workspace    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:
AccountId string
Account ID (UUID), defaults to the account set in the provider
Created string
Timestamp of when the resource was created (RFC3339)
Description string
Description for the workspace
Handle string
Unique handle for the workspace
Name string
Name of the workspace
Updated string
Timestamp of when the resource was updated (RFC3339)
AccountId string
Account ID (UUID), defaults to the account set in the provider
Created string
Timestamp of when the resource was created (RFC3339)
Description string
Description for the workspace
Handle string
Unique handle for the workspace
Name string
Name of the workspace
Updated string
Timestamp of when the resource was updated (RFC3339)
accountId String
Account ID (UUID), defaults to the account set in the provider
created String
Timestamp of when the resource was created (RFC3339)
description String
Description for the workspace
handle String
Unique handle for the workspace
name String
Name of the workspace
updated String
Timestamp of when the resource was updated (RFC3339)
accountId string
Account ID (UUID), defaults to the account set in the provider
created string
Timestamp of when the resource was created (RFC3339)
description string
Description for the workspace
handle string
Unique handle for the workspace
name string
Name of the workspace
updated string
Timestamp of when the resource was updated (RFC3339)
account_id str
Account ID (UUID), defaults to the account set in the provider
created str
Timestamp of when the resource was created (RFC3339)
description str
Description for the workspace
handle str
Unique handle for the workspace
name str
Name of the workspace
updated str
Timestamp of when the resource was updated (RFC3339)
accountId String
Account ID (UUID), defaults to the account set in the provider
created String
Timestamp of when the resource was created (RFC3339)
description String
Description for the workspace
handle String
Unique handle for the workspace
name String
Name of the workspace
updated String
Timestamp of when the resource was updated (RFC3339)

Import

Prefect Workspaces can be imported via handle/workspace-handle

$ pulumi import prefect:index/workspace:Workspace example handle/workspace-handle
Copy

or via workspace_id

$ pulumi import prefect:index/workspace:Workspace example 00000000-0000-0000-0000-000000000000
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
prefect prefecthq/terraform-provider-prefect
License
Notes
This Pulumi package is based on the prefect Terraform Provider.