Hello, I have a problem creating blocks with Terra...
# ask-community
p
Hello, I have a problem creating blocks with Terraform. Documentation is not complete, at least for me that I am not a terraform expert, and the command
prefect block types inspect s3-bucket
gives no help 😕 . It's not clear how to create a s3-bucket block linked to an aws-credential block. I tried different approach but non of them is working. This is my code:
Copy code
resource "prefect_block" "block_aws_credentials_prod" {
  name      = "test-credentials"
  type_slug = "aws-credentials"

  data = jsonencode({
    "aws_access_key_id"     = "XXXXX",
    "aws_secret_access_key" = ""
  })
}

resource "prefect_block" "block_s3_wsf_event_data" {
  name      = "test-bucket"
  type_slug = "s3-bucket"
  data = jsonencode({
    "bucket_name"           = "wsf-event-data"
    "credentials"     = prefect_block.block_aws_credentials_prod.data
  })
}
Does anybody have a good idea of how to solve it? thanks.
Any idea here?
l
I'm also trying to use terraform to manage blocks in Prefect Cloud that should be linked. In my case, I'm trying to link block types from prefect-dbt. I've also seen that
prefect block types inspect <block-type-slug>
does not show the schema as advertised. I've tried referencing the
<http://prefect_block.my|prefect_block.my>_block.id
and just
<http://prefect_block.my|prefect_block.my>_block
, but neither worked.
✅ 1
I found this example that Marvin gave you, so now I'm trying to use
.name
as the reference between blocks.
n
hey all, not sure if you’ve seen this , but if that’s not working, please feel free to open an issue if that doesn’t work
p
Yes, I saw that doc, but unfortunately doesn't help much. I started by open an issue for missing schemas and doc: https://github.com/PrefectHQ/terraform-provider-prefect/issues/239
l