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

Namespaced functions #335

Closed
MicaiahReid opened this issue Apr 14, 2024 · 3 comments · Fixed by #343
Closed

Namespaced functions #335

MicaiahReid opened this issue Apr 14, 2024 · 3 comments · Fixed by #343
Labels
enhancement New feature or request

Comments

@MicaiahReid
Copy link

The official hcl repo now supports namespaced functions (as of this PR). Is there any plan to support that here? This is what I'd like to be able to do:

block "foo" "bar" { 
  foobar = namespace::some_function() 
}
@martinohmann
Copy link
Owner

Thanks for the hint. I also recently stumbled across this but forgot to create an issue for that myself. I want to support this, especially now that this also landed in terraform. I'm going to read up on the specifics in the next few days and will try to implement it.

@martinohmann martinohmann added the enhancement New feature or request label Apr 17, 2024
@MicaiahReid
Copy link
Author

Beautiful, thanks @martinohmann!

martinohmann added a commit that referenced this issue May 16, 2024
Closes #335

This adds support for namespaced HCL function calls. The PR includes updates to the HCL parser (`hcl-edit`), formatter (`hcl-rs`), evaluation context (`hcl-rs`), encoder (`hcl-edit`) and visitors (`hcl-edit`).

BREAKING CHANGE: The `ident` field of `hcl_edit::expr::FuncCall` was renamed to `name`. Its type changed from `Decorated<Ident>` to `FuncName`. The type of `hcl::expr::FuncCall`'s `name` field changed from `Identifier` to `FuncName`. Various other places in the codebase that previously used bare identifiers as type now use `FuncName` to accommodate the change.
@martinohmann
Copy link
Owner

@MicaiahReid I just released support for namespaced functions in hcl-edit 0.8.0 and hcl-rs 0.17.0. This required some breaking changes, see the linked PR for more information.

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

Successfully merging a pull request may close this issue.

2 participants