Closed lukeorland closed 2 weeks ago
Did a quick test to try to replicate this. So in the prefect CLI, the value appears to have persisted:
But in the UI, it does indeed say None
:
We can dig a bit more - I wonder if it's just a UI bug.
hey @lukeorland, thanks for raising this issue. it looks like we're missing some logic + documentation to handle Block attributes that are $ref
(references) to other Blocks via ID
For example, our API (which takes a JSON schema spec) expects an attribute like dbt_cli_profile
that references another Block to be nested in the payload:
{
"$ref": {
"block_document_id": "12345-67890-12345-67890"
}
}
resource "prefect_block" "my_dbt_run_operation_block" {
name = "my-dbt-operations"
type_slug = "dbt-core-operation"
data = jsonencode({
"commands" = ["dbt deps", "dbt seed", "dbt run"]
"dbt_cli_profile" = { "$ref" : { "block_document_id" : prefect_block.my_dbt_cli_profile.id } }
})
}
however, there's currently a bug that prevents ☝ from being applied correctly. let us take a closer look at it and push up a fix
^ That config (with $ref
) worked for me on a fresh tf apply
:
It breaks when trying go from the improper config to the proper config: inconsistent values for sensitive attribute
.
Taking a look.
Thanks again for the report @lukeorland, we've released v.2.2.1 containing the fix.
Community Note
Terraform Version
Terraform v1.9.4 (Terraform Cloud)
Affected Resource(s)
prefect_block
Terraform Configuration Files
Does referencing other resources not work within the
data
field?Debug Output
Panic Output
Expected Behavior
I expect the
my-dbt-cli-profile
block to be set as the Dbt Cli Profile for thedbt-core-operation
-type block namedmy-dbt-operations
.Actual Behavior
Instead, the Dbt Cli Profile for the
dbt-core-operation
-type block namedmy-dbt-operations
is None.Steps to Reproduce
terraform apply
Important Factoids
Prior to attempting to use terraform, I was creating the same blocks using the Prefect Python SDK, and the block linking was working correctly, and my flow was using the blocks successfully in an ECS push work pool.
References
https://linen.prefect.io/t/22750298/hello-i-have-a-problem-creating-blocks-with-terraform-docume