Describe the bug
Expected one of:
* STRING_LIT
* FOR_EACH
* NL_OR_COMMENT
* IF
* NEGATIVE_DECIMAL
* FOR
* DECIMAL
* IN
* RBRACE
* NAME
When parsing this hcl (some content stripped out/anonymized because this is work code)
module "mymodule" {
source = "./modules/mymoudle"
roles = {
(var.role_name) = {
inline_policies = {
(var.policy_name) = local.policy_statements
}
},
(var.second_role_name) = {
trust_policy = [local.events_trust_policy]
inline_policies = {
(local.policy_name_inline) = local.events_policy_statements
}
}
}
policies = {
(var.policy_name) = {
description = "Policy"
statements = local.events_policy_statements
}
}
}
this works on the 6.x releae
Software:
- OS: [macOS / Windows / Linux] any
- Python version (e.g. 3.9.21) - tested on 3.10 to 3.13
- python-hcl2 version (e.g. 7.0.0) 7.0.0 and 7.0.1
Snippet of HCL2 code causing the unexpected behaviour:
module "mymodule" {
source = "./modules/mymoudle"
roles = {
(var.role_name) = {
inline_policies = {
(var.policy_name) = local.policy_statements
}
},
(var.second_role_name) = {
trust_policy = [local.events_trust_policy]
inline_policies = {
(local.policy_name_inline) = local.events_policy_statements
}
}
}
policies = {
(var.policy_name) = {
description = "Policy"
statements = local.events_policy_statements
}
}
}
Expected behavior
This HCL should parse. It does on 6.1.1
Exception traceback (if applicable):
Unexpected token Token('LPAR', '(') at line 178, column 5.
Expected one of:
* STRING_LIT
* FOR_EACH
* NL_OR_COMMENT
* IF
* NEGATIVE_DECIMAL
* FOR
* DECIMAL
* IN
* RBRACE
* NAME
Describe the bug
When parsing this hcl (some content stripped out/anonymized because this is work code)
this works on the 6.x releae
Software:
Snippet of HCL2 code causing the unexpected behaviour:
Expected behavior
This HCL should parse. It does on 6.1.1
Exception traceback (if applicable):