Closed niarora1406 closed 4 years ago
Terraform code in storage_Accounts.tf file :
resource "azurerm_storage_account" "PAN_FW_STG_AC" { name = join("",list("paloalto", substr(md5"${azurerm_resource_group.fw-e2-rg.name}+1", 0, 4))) resource_group_name = azurerm_resource_group.fw-e2-rg.name location = "eastus2" account_replication_type = "LRS" account_tier = "Standard" }
I don't see any error in my tf code as tf-plan and tf-apply works fine . i try to parse this code but it throws error :
import hcl
with open('storage-accounts.tf', 'r') as fp: obj = hcl.load(fp) print(obj)
Error:
ValueError: Line 7, column 315: unexpected LEFTPAREN; expected ASTERISK_PERIOD, RIGHTBRACKET, COMMA, RIGHTPAREN, ADD, MINUS, MULTIPLY, DIVIDE
That looks like HCL2 to me, which as the readme states is not supported.
You might try https://pypi.org/project/python-hcl2/
Terraform code in storage_Accounts.tf file :
resource "azurerm_storage_account" "PAN_FW_STG_AC" { name = join("",list("paloalto", substr(md5"${azurerm_resource_group.fw-e2-rg.name}+1", 0, 4))) resource_group_name = azurerm_resource_group.fw-e2-rg.name location = "eastus2" account_replication_type = "LRS" account_tier = "Standard" }
I don't see any error in my tf code as tf-plan and tf-apply works fine . i try to parse this code but it throws error :
import hcl
with open('storage-accounts.tf', 'r') as fp: obj = hcl.load(fp) print(obj)
Error:
ValueError: Line 7, column 315: unexpected LEFTPAREN; expected ASTERISK_PERIOD, RIGHTBRACKET, COMMA, RIGHTPAREN, ADD, MINUS, MULTIPLY, DIVIDE