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

prefect.Block

Explore with Pulumi AI

Import

prefect_block resources can be imported by the block_id

$ pulumi import prefect:index/block:Block my_block 00000000-0000-0000-0000-000000000000
Copy

or from a different workspace via block_id,workspace_id

$ pulumi import prefect:index/block:Block my_block 00000000-0000-0000-0000-000000000000,11111111-1111-1111-1111-111111111111
Copy

Create Block Resource

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

Constructor syntax

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

@overload
def Block(resource_name: str,
          opts: Optional[ResourceOptions] = None,
          data: Optional[str] = None,
          type_slug: Optional[str] = None,
          account_id: Optional[str] = None,
          name: Optional[str] = None,
          workspace_id: Optional[str] = None)
func NewBlock(ctx *Context, name string, args BlockArgs, opts ...ResourceOption) (*Block, error)
public Block(string name, BlockArgs args, CustomResourceOptions? opts = null)
public Block(String name, BlockArgs args)
public Block(String name, BlockArgs args, CustomResourceOptions options)
type: prefect:Block
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. BlockArgs
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. BlockArgs
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. BlockArgs
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. BlockArgs
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. BlockArgs
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 blockResource = new Prefect.Block("blockResource", new()
{
    Data = "string",
    TypeSlug = "string",
    AccountId = "string",
    Name = "string",
    WorkspaceId = "string",
});
Copy
example, err := prefect.NewBlock(ctx, "blockResource", &prefect.BlockArgs{
Data: pulumi.String("string"),
TypeSlug: pulumi.String("string"),
AccountId: pulumi.String("string"),
Name: pulumi.String("string"),
WorkspaceId: pulumi.String("string"),
})
Copy
var blockResource = new Block("blockResource", BlockArgs.builder()
    .data("string")
    .typeSlug("string")
    .accountId("string")
    .name("string")
    .workspaceId("string")
    .build());
Copy
block_resource = prefect.Block("blockResource",
    data="string",
    type_slug="string",
    account_id="string",
    name="string",
    workspace_id="string")
Copy
const blockResource = new prefect.Block("blockResource", {
    data: "string",
    typeSlug: "string",
    accountId: "string",
    name: "string",
    workspaceId: "string",
});
Copy
type: prefect:Block
properties:
    accountId: string
    data: string
    name: string
    typeSlug: string
    workspaceId: string
Copy

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

Data This property is required. string
The user-inputted Block payload, as a JSON string. Use jsonencode on the provided value to satisfy the underlying JSON type. The value's schema will depend on the selected type slug. Use prefect block type inspect <slug> to view the data schema for a given Block type.
TypeSlug This property is required. string
Block Type slug, which determines the schema of the data JSON attribute. Use prefect block type ls to view all available Block type slugs.
AccountId string
Account ID (UUID) where the Block is located
Name string
Unique name of the Block
WorkspaceId string
Workspace ID (UUID) where the Block is located. In Prefect Cloud, either the prefect.Block resource or the provider's workspace_id must be set.
Data This property is required. string
The user-inputted Block payload, as a JSON string. Use jsonencode on the provided value to satisfy the underlying JSON type. The value's schema will depend on the selected type slug. Use prefect block type inspect <slug> to view the data schema for a given Block type.
TypeSlug This property is required. string
Block Type slug, which determines the schema of the data JSON attribute. Use prefect block type ls to view all available Block type slugs.
AccountId string
Account ID (UUID) where the Block is located
Name string
Unique name of the Block
WorkspaceId string
Workspace ID (UUID) where the Block is located. In Prefect Cloud, either the prefect.Block resource or the provider's workspace_id must be set.
data This property is required. String
The user-inputted Block payload, as a JSON string. Use jsonencode on the provided value to satisfy the underlying JSON type. The value's schema will depend on the selected type slug. Use prefect block type inspect <slug> to view the data schema for a given Block type.
typeSlug This property is required. String
Block Type slug, which determines the schema of the data JSON attribute. Use prefect block type ls to view all available Block type slugs.
accountId String
Account ID (UUID) where the Block is located
name String
Unique name of the Block
workspaceId String
Workspace ID (UUID) where the Block is located. In Prefect Cloud, either the prefect.Block resource or the provider's workspace_id must be set.
data This property is required. string
The user-inputted Block payload, as a JSON string. Use jsonencode on the provided value to satisfy the underlying JSON type. The value's schema will depend on the selected type slug. Use prefect block type inspect <slug> to view the data schema for a given Block type.
typeSlug This property is required. string
Block Type slug, which determines the schema of the data JSON attribute. Use prefect block type ls to view all available Block type slugs.
accountId string
Account ID (UUID) where the Block is located
name string
Unique name of the Block
workspaceId string
Workspace ID (UUID) where the Block is located. In Prefect Cloud, either the prefect.Block resource or the provider's workspace_id must be set.
data This property is required. str
The user-inputted Block payload, as a JSON string. Use jsonencode on the provided value to satisfy the underlying JSON type. The value's schema will depend on the selected type slug. Use prefect block type inspect <slug> to view the data schema for a given Block type.
type_slug This property is required. str
Block Type slug, which determines the schema of the data JSON attribute. Use prefect block type ls to view all available Block type slugs.
account_id str
Account ID (UUID) where the Block is located
name str
Unique name of the Block
workspace_id str
Workspace ID (UUID) where the Block is located. In Prefect Cloud, either the prefect.Block resource or the provider's workspace_id must be set.
data This property is required. String
The user-inputted Block payload, as a JSON string. Use jsonencode on the provided value to satisfy the underlying JSON type. The value's schema will depend on the selected type slug. Use prefect block type inspect <slug> to view the data schema for a given Block type.
typeSlug This property is required. String
Block Type slug, which determines the schema of the data JSON attribute. Use prefect block type ls to view all available Block type slugs.
accountId String
Account ID (UUID) where the Block is located
name String
Unique name of the Block
workspaceId String
Workspace ID (UUID) where the Block is located. In Prefect Cloud, either the prefect.Block resource or the provider's workspace_id must be set.

Outputs

All input properties are implicitly available as output properties. Additionally, the Block 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 Block Resource

Get an existing Block 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?: BlockState, opts?: CustomResourceOptions): Block
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        account_id: Optional[str] = None,
        created: Optional[str] = None,
        data: Optional[str] = None,
        name: Optional[str] = None,
        type_slug: Optional[str] = None,
        updated: Optional[str] = None,
        workspace_id: Optional[str] = None) -> Block
func GetBlock(ctx *Context, name string, id IDInput, state *BlockState, opts ...ResourceOption) (*Block, error)
public static Block Get(string name, Input<string> id, BlockState? state, CustomResourceOptions? opts = null)
public static Block get(String name, Output<String> id, BlockState state, CustomResourceOptions options)
resources:  _:    type: prefect:Block    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) where the Block is located
Created string
Timestamp of when the resource was created (RFC3339)
Data string
The user-inputted Block payload, as a JSON string. Use jsonencode on the provided value to satisfy the underlying JSON type. The value's schema will depend on the selected type slug. Use prefect block type inspect <slug> to view the data schema for a given Block type.
Name string
Unique name of the Block
TypeSlug string
Block Type slug, which determines the schema of the data JSON attribute. Use prefect block type ls to view all available Block type slugs.
Updated string
Timestamp of when the resource was updated (RFC3339)
WorkspaceId string
Workspace ID (UUID) where the Block is located. In Prefect Cloud, either the prefect.Block resource or the provider's workspace_id must be set.
AccountId string
Account ID (UUID) where the Block is located
Created string
Timestamp of when the resource was created (RFC3339)
Data string
The user-inputted Block payload, as a JSON string. Use jsonencode on the provided value to satisfy the underlying JSON type. The value's schema will depend on the selected type slug. Use prefect block type inspect <slug> to view the data schema for a given Block type.
Name string
Unique name of the Block
TypeSlug string
Block Type slug, which determines the schema of the data JSON attribute. Use prefect block type ls to view all available Block type slugs.
Updated string
Timestamp of when the resource was updated (RFC3339)
WorkspaceId string
Workspace ID (UUID) where the Block is located. In Prefect Cloud, either the prefect.Block resource or the provider's workspace_id must be set.
accountId String
Account ID (UUID) where the Block is located
created String
Timestamp of when the resource was created (RFC3339)
data String
The user-inputted Block payload, as a JSON string. Use jsonencode on the provided value to satisfy the underlying JSON type. The value's schema will depend on the selected type slug. Use prefect block type inspect <slug> to view the data schema for a given Block type.
name String
Unique name of the Block
typeSlug String
Block Type slug, which determines the schema of the data JSON attribute. Use prefect block type ls to view all available Block type slugs.
updated String
Timestamp of when the resource was updated (RFC3339)
workspaceId String
Workspace ID (UUID) where the Block is located. In Prefect Cloud, either the prefect.Block resource or the provider's workspace_id must be set.
accountId string
Account ID (UUID) where the Block is located
created string
Timestamp of when the resource was created (RFC3339)
data string
The user-inputted Block payload, as a JSON string. Use jsonencode on the provided value to satisfy the underlying JSON type. The value's schema will depend on the selected type slug. Use prefect block type inspect <slug> to view the data schema for a given Block type.
name string
Unique name of the Block
typeSlug string
Block Type slug, which determines the schema of the data JSON attribute. Use prefect block type ls to view all available Block type slugs.
updated string
Timestamp of when the resource was updated (RFC3339)
workspaceId string
Workspace ID (UUID) where the Block is located. In Prefect Cloud, either the prefect.Block resource or the provider's workspace_id must be set.
account_id str
Account ID (UUID) where the Block is located
created str
Timestamp of when the resource was created (RFC3339)
data str
The user-inputted Block payload, as a JSON string. Use jsonencode on the provided value to satisfy the underlying JSON type. The value's schema will depend on the selected type slug. Use prefect block type inspect <slug> to view the data schema for a given Block type.
name str
Unique name of the Block
type_slug str
Block Type slug, which determines the schema of the data JSON attribute. Use prefect block type ls to view all available Block type slugs.
updated str
Timestamp of when the resource was updated (RFC3339)
workspace_id str
Workspace ID (UUID) where the Block is located. In Prefect Cloud, either the prefect.Block resource or the provider's workspace_id must be set.
accountId String
Account ID (UUID) where the Block is located
created String
Timestamp of when the resource was created (RFC3339)
data String
The user-inputted Block payload, as a JSON string. Use jsonencode on the provided value to satisfy the underlying JSON type. The value's schema will depend on the selected type slug. Use prefect block type inspect <slug> to view the data schema for a given Block type.
name String
Unique name of the Block
typeSlug String
Block Type slug, which determines the schema of the data JSON attribute. Use prefect block type ls to view all available Block type slugs.
updated String
Timestamp of when the resource was updated (RFC3339)
workspaceId String
Workspace ID (UUID) where the Block is located. In Prefect Cloud, either the prefect.Block resource or the provider's workspace_id must be set.

Package Details

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