Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Block "data" argument: Clarify expected data format #257

Merged
merged 2 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/resources/block.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ resource "prefect_block" "aws_credentials_from_file" {
type_slug = "aws-credentials"

# prefect block type inspect aws-credentials
data = file("./aws-credentials.json")
data = jsonencode(file("./aws-credentials.json"))
}

# example:
Expand Down Expand Up @@ -111,7 +111,7 @@ For more information on the `$ref` syntax definition, see the

### 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 type inspect <slug>` to view the data schema for a given Block type.
- `data` (String, Sensitive) 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
- `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.

Expand Down
2 changes: 1 addition & 1 deletion examples/resources/prefect_block/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ resource "prefect_block" "aws_credentials_from_file" {
type_slug = "aws-credentials"

# prefect block type inspect aws-credentials
data = file("./aws-credentials.json")
data = jsonencode(file("./aws-credentials.json"))
}

# example:
Expand Down
4 changes: 2 additions & 2 deletions internal/provider/datasources/account_member_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ func TestAccDatasource_account_member(t *testing.T) {
PreCheck: func() { testutils.AccTestPreCheck(t) },
Steps: []resource.TestStep{
{
Config: fixtureAccAccountMember("marvin+tf-acceptance-tester@prefect.io"),
Config: fixtureAccAccountMember("[email protected]"),
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr(dataSourceName, "email", "marvin+tf-acceptance-tester@prefect.io"),
resource.TestCheckResourceAttr(dataSourceName, "email", "[email protected]"),
resource.TestCheckResourceAttrSet(dataSourceName, "id"),
resource.TestCheckResourceAttrSet(dataSourceName, "account_role_id"),
resource.TestCheckResourceAttrSet(dataSourceName, "account_role_name"),
Expand Down
2 changes: 1 addition & 1 deletion internal/provider/resources/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,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 type inspect <slug>` to view the data schema for a given Block type.",
Description: "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.",
},
"account_id": schema.StringAttribute{
Optional: true,
Expand Down
Loading