Skip to content

Issues with parenthesis in locals #219

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

Closed
dustyhorizon opened this issue Apr 10, 2025 · 1 comment · Fixed by #227
Closed

Issues with parenthesis in locals #219

dustyhorizon opened this issue Apr 10, 2025 · 1 comment · Fixed by #227
Assignees
Labels
bug Something isn't working fixed-unreleased Fix merged into main; waiting for version release

Comments

@dustyhorizon
Copy link

dustyhorizon commented Apr 10, 2025

Describe the bug

Unable to load if (...) is being used in the locals block.

Possibly similar to #211

Software:

  • OS: Linux
  • Python version 3.12.8
  • python-hcl2 version 7.1.0

Snippet of HCL2 code causing the unexpected behaviour:

locals {
  this_aws_eks_cluster_default_tags = {
    format(
      "kubernetes.io/cluster/%s",
      module.this_aws_eks_cluster.eks_cluster.id,
    )                        = "owned"
    "karpenter.sh/discovery" = module.this_aws_eks_cluster.eks_cluster.id
  }
}

Expected behavior

HCL should be parsed without errors

Exception traceback (if applicable):

UnexpectedToken: Unexpected token Token('LPAR', '(') at line 3, column 11.
Expected one of:
        * EQ
        * COLON
        * RPAR
        * DOT
@dustyhorizon dustyhorizon added the bug Something isn't working label Apr 10, 2025
@dustyhorizon
Copy link
Author

Seems like this issue cannot be solved with the same workaround for #220

@kkozik-amplify kkozik-amplify added the fixed-unreleased Fix merged into main; waiting for version release label Apr 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed-unreleased Fix merged into main; waiting for version release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants