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

hcldec: how to use block_attrs? #670

Open
antoinedeschenes opened this issue Mar 13, 2024 · 1 comment
Open

hcldec: how to use block_attrs? #670

antoinedeschenes opened this issue Mar 13, 2024 · 1 comment

Comments

@antoinedeschenes
Copy link

I don't understand how I'm supposed to use the block_attrs spec, and there are no examples in the hcldec documentation.

If I use the spec file here:

object {
  block_attrs {
    block_type = "locals"
    element_type = any
    required = false
  }
}

I'm trying to parse a locals block filled with random attributes such as the hcl file here:

locals {
  foo = "bar"
}

the latest version of hcldec outputs the following error:

Error: Unsupported block type

  on spec.hcl line 2, in object:
   2:   block_attrs {

Blocks of type "block_attrs" are not expected here.
@apparentlymart
Copy link
Member

Hi @antoinedeschenes,

This feature doesn't seem to be fully implemented in hcldec yet. Some of the logic to handle it is there, but in particular it's missing from the "spec" schema and so the config loader doesn't understand what to do with it.

This command line tool is not really used by anything at HashiCorp aside from HCL's own spec test suite, so it tends to get improvements only when the spec test suite needs improving. I'm open to finishing the support for this particular spec type, but I'm afraid I don't currently have time to work on it myself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants