Skip to content

fix: bump hcl2json parser to v0.6.9 for namespaced provider functions#535

Merged
jaredfholgate merged 1 commit into
mainfrom
jaredfholgate-bump-hcl2json-v0-6-9
Jun 25, 2026
Merged

fix: bump hcl2json parser to v0.6.9 for namespaced provider functions#535
jaredfholgate merged 1 commit into
mainfrom
jaredfholgate-bump-hcl2json-v0-6-9

Conversation

@jaredfholgate

Copy link
Copy Markdown
Member

Summary

Bumps the pinned hcl2json (HCLToJSON) parser version from v0.6.0 to v0.6.9 in Deploy-Accelerator.ps1, so the accelerator can parse Terraform provider-defined (namespaced) functions.

Root cause

When running Deploy-Accelerator, the ALZ module downloads the tmccombs/hcl2json binary and uses it to convert the accelerator's variables.*.tf template files into JSON to build the input config schema.

A template in the alz-terraform-accelerator repo (templates/platform_landing_zone/variables.connectivity.virtual.wan.tf) now uses a provider-defined function:

|| can(provider::azapi::parse_resource_id("Microsoft.Network/virtualWans", var.virtual_wan_settings.virtual_wan.id).name)

The pinned hcl2json v0.6.0 vendors github.com/hashicorp/hcl/v2 v2.17.0, which predates support for the namespaced provider::<ns>::<func>() call syntax (added to hashicorp/hcl/v2 in v2.20.0, "Support for namespaced functions"). So v0.6.0 parses provider as a normal identifier, hits the first ::, and fails:

Failed to convert file: parse config: [...variables.connectivity.virtual.wan.tf:1043,22-23: Missing argument separator; A comma is required to separate each function argument from the next.]

(col 22–23 is exactly the first ::.)

Fix

Bump to hcl2json v0.6.9 (latest release), which vendors hashicorp/hcl/v2 v2.24.0 and fully supports the namespaced function syntax. This unblocks parsing of provider::azapi::parse_resource_id in the platform landing zone variables.

Notes

  • Private/Tools/Get-HCLParserTool.ps1 needs no changes — it builds the asset filename as hcl2json_<os>_<arch> (plus .exe on Windows) and downloads from https://github.com/tmccombs/hcl2json/releases/download/<toolVersion>/<asset>. The v0.6.9 release assets keep the same naming scheme, so the downloader is compatible.
  • v0.6.0 was the only hard-coded reference to the parser version in the repo; the .gitignore entry for the binary is version-agnostic and the unit tests mock Get-HCLParserTool.
  • Module versioning is handled by release automation (release-drafter), so the .psd1 ModuleVersion is intentionally left untouched, matching repo precedent.

Validation

Invoke-Build -File .\src\ALZ.build.ps1 -Task TestLocalBuild succeeded. 7 tasks, 0 errors, 0 warnings.

  • PSScriptAnalyzer (Module + Tests): clean
  • Pester: 47 passed, 0 failed, 0 skipped

Files changed

  • src/ALZ/Public/Deploy-Accelerator.ps1toolVersion v0.6.0v0.6.9

Bump the pinned hcl2json (HCLToJSON) parser from v0.6.0 to v0.6.9 so it can parse Terraform provider-defined (namespaced) functions used in the accelerator templates, e.g. provider::azapi::parse_resource_id.

Root cause: v0.6.0 vendors hashicorp/hcl/v2 v2.17.0, which predates support for the namespaced provider::<ns>::<func>() call syntax (added in hcl v2.20.0). It therefore fails parsing variables.connectivity.virtual.wan.tf with 'Missing argument separator' at the first ::. v0.6.9 vendors hcl v2.24.0, which fully supports the syntax. The release assets keep the same naming scheme, so Get-HCLParserTool needs no changes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jaredfholgate jaredfholgate merged commit 512efc6 into main Jun 25, 2026
8 checks passed
@jaredfholgate jaredfholgate deleted the jaredfholgate-bump-hcl2json-v0-6-9 branch June 25, 2026 08:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs: Triage 🔍 Needs triaging by the team

Projects

Development

Successfully merging this pull request may close these issues.

2 participants