python-hcl2
python-hcl2 copied to clipboard
I am hitting an issue with https://github.com/bridgecrewio/checkov/ throwing a parsing error where a .tf file containing an `aws_codebuild_project` resource has a `buildspec` attribute defined using a heredoc that contains a...
**Context** We use this library to parse and modify Terraform files. We do this by reading a particular resource using this library, then using the data from that to write...
I have the following Terraform local: ``` my_local = { for k, v in local.map_a : k => v if lookup(local.map_b[v.id], "enabled", false) || ( contains(local.map_c, v.id) && contains(local.map_d, v.id)...
Parsing a multi-line conditional expression causes exception - Unexpected token Token('QMARK', '?')
Hello! I have observed that parsing a ternary expression fails if the expression is using multiple lines. For example: ``` data "aws_iam_policy_document" "sample" { source_json = ( length(var.sample_value) > 0...
I love the feature where you include line numbers to blocks. Why was this not extended to objecs? https://github.com/amplify-education/python-hcl2/blob/252ebaf9179e3fb41a4637e0c4f6bf5b9aa52698/hcl2/transformer.py#L100-L105 I tried out a small alteration, and it seems to work...
We have recently discovered that some of our users have been deploying Vault policies formatted like below, where the opening curly bracket is placed below the line: ``` path "secretspath/*"...
**Issue** ``` >>> from hcl2 import loads >>> loads('a=1*(2+3)') {'a': ['${1 * 2 + 3}']} ``` **Expect** ``` {'a': ['${1*(2+3)}']} ```
For example: ``` attr =
Something has changed within `loads` function as now with 3.0.0 it is impossible to parse tf files in recursive functions. ```tf from pathlib import Path, PosixPath from typing import Iterable,...
Parsing error: tfvars to json: terraform.tfvars: ``` ping_sg_cidr = { 1 = { cidr_blocks = [ "0.0.0.0/0" ] from_port = 8 to_port = -1 description = "Allow ping connections" protocol...