amplify-education / python-hcl2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unexpected token Token(DECIMAL, '0') when loading terraform file

Ozymandiiaz opened this issue · comments

Hello,

I have this error when trying to load a terraform output file :

Unexpected token Token(DECIMAL, '0') at line 3, column 75.
Expected one of:
        * __ANON_3

My terraform output file

output "webapp_site_credential_user_name" {
  description = "Credentials of Webapp"
  value       = join("", azurerm_app_service.appservice.*.site_credential.0.username)
}

It's seems the hcl2.load(file) does not like the "site_credential.0" even if this code is working in terraform.
How can i fix this without changing my terraform code ?

#####################################################################

Terraform module to create web tier for web-tier

#####################################################################

output "instances_ips" {
value = join(",", concat(ibm_is_instance.instance_az1..primary_network_interface.0.primary_ipv4_address,ibm_is_instance.instance_az2..primary_network_interface.0.primary_ipv4_address))
}

output "instances_names" {
value = concat(ibm_is_instance.instance_az1..name, ibm_is_instance.instance_az2..name)
}

Getting same issue for above block in terraform
Can some one please look into it

@aoskotsky-amplify @ahlinc @pbchekin @greut @mariusvniekerk @stpierre
we are using this pakcage for hcl to json conversion ..can you please look into it on priority ?

I don't believe that is valid hcl2. You should be doing join("", azurerm_app_service.appservice.*.site_credential[0].username). See https://github.com/hashicorp/hcl/blob/main/hclsyntax/spec.md#attribute-access-operator