Skip to content

Commit

Permalink
Merge branch 'main' into resource_deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
parkedwards authored Aug 14, 2024
2 parents 265a7cf + 5f00182 commit f744c5a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion docs/data-sources/block.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,5 @@ data "prefect_block" "existing_by_id_string" {
### Read-Only

- `created` (String) Timestamp of when the resource was created (RFC3339)
- `data` (String, Sensitive) The user-inputted Block payload, as a JSON string. The value's schema will depend on the selected `type` slug. Use `prefect block types inspect <slug>` to view the data schema for a given Block type.
- `data` (String, Sensitive) The user-inputted Block payload, as a JSON string. 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.
- `updated` (String) Timestamp of when the resource was updated (RFC3339)
14 changes: 8 additions & 6 deletions docs/resources/block.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,18 @@ subcategory: ""
description: |-
The resource block allows creating and managing Prefect Blocks https://docs.prefect.io/latest/concepts/blocks/, which are primitives for configuration / secrets in your flows.
block resources represent configurations for schemas for all different Block types. Because of the polymorphic nature of Blocks, you should utilize the prefect CLI https://docs.prefect.io/latest/getting-started/installation/ to inspect all Block types and schemas.
Use prefect block types ls to view all available Block type slugs, which is used in the type_slug attribute.
Use prefect block types inspect <slug> to view the data schema for a given Block type. Use this to construct the data attribute value (as JSON string).
Note: you should be on version 3.0.0rc1 or later to use the following commands:
Use prefect block type ls to view all available Block type slugs, which is used in the type_slug attribute.
Use prefect block type inspect <slug> to view the data schema for a given Block type. Use this to construct the data attribute value (as JSON string).
---

# prefect_block (Resource)

The resource `block` allows creating and managing [Prefect Blocks](https://docs.prefect.io/latest/concepts/blocks/), which are primitives for configuration / secrets in your flows.
`block` resources represent configurations for schemas for all different Block types. Because of the polymorphic nature of Blocks, you should utilize the `prefect` [CLI](https://docs.prefect.io/latest/getting-started/installation/) to inspect all Block types and schemas.
Use `prefect block types ls` to view all available Block type slugs, which is used in the `type_slug` attribute.
Use `prefect block types inspect <slug>` to view the data schema for a given Block type. Use this to construct the `data` attribute value (as JSON string).
*Note:* you should be on version `3.0.0rc1` or later to use the following commands:
Use `prefect block type ls` to view all available Block type slugs, which is used in the `type_slug` attribute.
Use `prefect block type inspect <slug>` to view the data schema for a given Block type. Use this to construct the `data` attribute value (as JSON string).

## Example Usage

Expand Down Expand Up @@ -75,9 +77,9 @@ resource "prefect_block" "gcp_credentials_key" {

### Required

- `data` (String, Sensitive) The user-inputted Block payload, as a JSON string. The value's schema will depend on the selected `type` slug. Use `prefect block types inspect <slug>` to view the data schema for a given Block type.
- `data` (String, Sensitive) The user-inputted Block payload, as a JSON string. 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
- `type_slug` (String) Block Type slug, which determines the schema of the `data` JSON attribute. Use `prefect block types ls` to view all available Block type slugs.
- `type_slug` (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.

### Optional

Expand Down
2 changes: 1 addition & 1 deletion internal/provider/datasources/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ Use this data source to obtain Block-specific attributes, such as the data.
Computed: true,
Sensitive: true,
CustomType: jsontypes.NormalizedType{},
Description: "The user-inputted Block payload, as a JSON string. The value's schema will depend on the selected `type` slug. Use `prefect block types inspect <slug>` to view the data schema for a given Block type.",
Description: "The user-inputted Block payload, as a JSON string. 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": schema.StringAttribute{
Computed: true,
Expand Down
10 changes: 6 additions & 4 deletions internal/provider/resources/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,11 @@ func (r *BlockResource) Schema(_ context.Context, _ resource.SchemaRequest, resp
"`block` resources represent configurations for schemas for all different Block types. " +
"Because of the polymorphic nature of Blocks, you should utilize the `prefect` [CLI](https://docs.prefect.io/latest/getting-started/installation/) to inspect all Block types and schemas." +
"\n" +
"Use `prefect block types ls` to view all available Block type slugs, which is used in the `type_slug` attribute." +
"*Note:* you should be on version `3.0.0rc1` or later to use the following commands:" +
"\n" +
"Use `prefect block types inspect <slug>` to view the data schema for a given Block type. Use this to construct the `data` attribute value (as JSON string).",
"Use `prefect block type ls` to view all available Block type slugs, which is used in the `type_slug` attribute." +
"\n" +
"Use `prefect block type inspect <slug>` to view the data schema for a given Block type. Use this to construct the `data` attribute value (as JSON string).",
Version: 0,
Attributes: map[string]schema.Attribute{
"id": schema.StringAttribute{
Expand Down Expand Up @@ -105,7 +107,7 @@ func (r *BlockResource) Schema(_ context.Context, _ resource.SchemaRequest, resp
},
"type_slug": schema.StringAttribute{
Required: true,
Description: "Block Type slug, which determines the schema of the `data` JSON attribute. Use `prefect block types ls` to view all available Block type slugs.",
Description: "Block Type slug, which determines the schema of the `data` JSON attribute. Use `prefect block type ls` to view all available Block type slugs.",
PlanModifiers: []planmodifier.String{
stringplanmodifier.RequiresReplace(),
},
Expand All @@ -114,7 +116,7 @@ func (r *BlockResource) Schema(_ context.Context, _ resource.SchemaRequest, resp
Required: true,
Sensitive: true,
CustomType: jsontypes.NormalizedType{},
Description: "The user-inputted Block payload, as a JSON string. The value's schema will depend on the selected `type` slug. Use `prefect block types inspect <slug>` to view the data schema for a given Block type.",
Description: "The user-inputted Block payload, as a JSON string. 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.",
},
"account_id": schema.StringAttribute{
Optional: true,
Expand Down

0 comments on commit f744c5a

Please sign in to comment.