You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are submitting a file_name.hcl.json to atlantis, before plan and apply runs, pre-workflow-hook terragrunt-atlantis-config_1.14.2_linux_amd64 generate --output atlantis.yaml --parallel=false --autoplan --automerge --ignore-dependency-blocks=true runs which should have generated atlantis.yaml, but it didn't generate any such file and when I manually ran the pre-workflow-hook command it gave error as file_name.hcl.json:1,1-2: Argument or block definition required; An argument or block definition is required here.
content of file_name.hcl.json
but if I run terragrunt plan locally in that file location it works.
captured server logs from atlantis when file_name.hcl.json is submitted
Aug 24 19:40:50 atlantis-vm atlantis[93604]: {"level":"info","ts":"2022-08-24T19:40:50.484Z","caller":"server/server.go:864","msg":"Apply Lock: {false 0001-01-01 00:00:00 +0000 UTC }","json":{}}
Aug 24 19:40:51 atlantis-vm atlantis[93604]: {"level":"info","ts":"2022-08-24T19:40:51.523Z","caller":"server/server.go:864","msg":"Apply Lock: {false 0001-01-01 00:00:00 +0000 UTC }","json":{}}
Aug 24 19:40:53 atlantis-vm atlantis[93604]: {"level":"info","ts":"2022-08-24T19:40:53.534Z","caller":"server/server.go:864","msg":"Apply Lock: {false 0001-01-01 00:00:00 +0000 UTC }","json":{}}
Aug 24 19:40:54 atlantis-vm atlantis[93604]: {"level":"info","ts":"2022-08-24T19:40:54.983Z","caller":"events/events_controller.go:461","msg":"identified event as type \"updated\"","json":{}}
Aug 24 19:40:54 atlantis-vm atlantis[93604]: {"level":"info","ts":"2022-08-24T19:40:54.983Z","caller":"events/events_controller.go:346","msg":"executing autoplan","json":{}}
Aug 24 19:40:55 atlantis-vm atlantis[93604]: {"level":"info","ts":"2022-08-24T19:40:55.013Z","caller":"events/working_dir.go:202","msg":"creating dir \"/opt/atlantis/.atlantis/repos/iac/iac/XXX/default\"","json":{"repo":"iac/iac","pull":"XXX"}}
Aug 24 19:40:55 atlantis-vm atlantis[93604]: {"level":"info","ts":"2022-08-24T19:40:55.483Z","caller":"server/server.go:864","msg":"Apply Lock: {false 0001-01-01 00:00:00 +0000 UTC }","json":{}}
Aug 24 19:40:56 atlantis-vm atlantis[93604]: {"level":"info","ts":"2022-08-24T19:40:56.523Z","caller":"server/server.go:864","msg":"Apply Lock: {false 0001-01-01 00:00:00 +0000 UTC }","json":{}}
Aug 24 19:40:58 atlantis-vm atlantis[93604]: {"level":"info","ts":"2022-08-24T19:40:58.533Z","caller":"server/server.go:864","msg":"Apply Lock: {false 0001-01-01 00:00:00 +0000 UTC }","json":{}}
Aug 24 19:41:00 atlantis-vm atlantis[93604]: {"level":"info","ts":"2022-08-24T19:41:00.483Z","caller":"server/server.go:864","msg":"Apply Lock: {false 0001-01-01 00:00:00 +0000 UTC }","json":{}}
Aug 24 19:41:00 atlantis-vm atlantis[93604]: {"level":"error","ts":"2022-08-24T19:41:00.606Z","caller":"events/command_runner.go:159","msg":"Error running pre-workflow hooks exit status 1: running \"terragrunt-atlantis-config_1.14.2_linux_amd64 generate --output atlantis.yaml --parallel=false --autoplan --automerge --ignore-dependency-blocks=true\" in \"/opt/atlantis/.atlantis/repos/iac/iac/XXX/default\": \ntime=\"2022-08-24T19:40:55Z\" level=info msg=\"Could not find an old config file. Starting from scratch\"\ntime=\"2022-08-24T19:40:55Z\" level=info msg=\"Created project for /opt/atlantis/.atlantis/repos/iac/iac/XXX/default/terragrunt.hcl\"\ntime=\"2022-08-24T19:40:55Z\" ...."}
Aug 24 19:41:00 atlantis-vm atlantis[93604]: {"level":"info","ts":"2022-08-24T19:41:00.975Z","caller":"events/project_command_builder.go:266","msg":"found no atlantis.yaml file","json":{"repo":"iac/iac","pull":"584"}}
Aug 24 19:41:00 atlantis-vm atlantis[93604]: {"level":"info","ts":"2022-08-24T19:41:00.975Z","caller":"events/project_command_builder.go:271","msg":"automatically determined that there were 0 projects modified in this pull request: []","json":{"repo":"iac/iac","pull":"584"}}
Aug 24 19:41:00 atlantis-vm atlantis[93604]: {"level":"info","ts":"2022-08-24T19:41:00.975Z","caller":"events/plan_command_runner.go:84","msg":"determined there was no project to run plan in","json":{"repo":"iac/iac","pull":"584"}}
Aug 24 19:41:01 atlantis-vm atlantis[93604]: {"level":"info","ts":"2022-08-24T19:41:01.522Z","caller":"server/server.go:864","msg":"Apply Lock: {false 0001-01-01 00:00:00 +0000 UTC }","json":{}}
Aug 24 19:41:03 atlantis-vm atlantis[93604]: {"level":"info","ts":"2022-08-24T19:41:03.533Z","caller":"server/server.go:864","msg":"Apply Lock: {false 0001-01-01 00:00:00 +0000 UTC }","json":{}}
Aug 24 19:41:05 atlantis-vm atlantis[93604]: {"level":"info","ts":"2022-08-24T19:41:05.483Z","caller":"server/server.go:864","msg":"Apply Lock: {false 0001-01-01 00:00:00 +0000 UTC }","json":{}}
Aug 24 19:41:06 atlantis-vm atlantis[93604]: {"level":"info","ts":"2022-08-24T19:41:06.523Z","caller":"server/server.go:864","msg":"Apply Lock: {false 0001-01-01 00:00:00 +0000 UTC }","json":{}}
The text was updated successfully, but these errors were encountered:
As per my understanding and debugging, this tool works as follows:
flowchart TB
subgraph generate.go
main-- for every hcl/json file --> createProject --> getDependencies
end
subgraph parse_hcl.go
getDependencies-->parseModule
parseModule-->decodeAsTerragruntInclude
decodeAsTerragruntInclude--decodes only the `include` blocks using-->decodeHcl
decodeHcl--calls to check bare include blocks-->updateBareIncludeBlock
end
subgraph parse_locals.go
decodeHcl--if configuration updated by updateBareInlucdeBlock: reparse hcl using-->parseHcl
parseModule--calls to parse hcl-->parseHcl
end
subgraph hclWrite_library
updateBareIncludeBlock--calls to update bare include blocks-->ParseConfig
end
During the course of execution, the tool checks if include blocks in terragrunt have a label or not. If there is no label, it calls updateBareIncludeBlock to update the bare include blocks with an empty label ("") .
However, due to the bug in the hclWrite library, when the hcl objects converted from .hcl.json file are passed as input to hclWrite, it throws following error:
Error: file_name.hcl.json:1,1-2: Argument or block definition required; An argument or block definition is required here.
Possible fix/workaround?
We can skip calling updateBareIncludeBlock function for .hcl.json file formats. Which in-turn will skip the call to hclwrite for the hcl objects generated from .hcl.json files.
We are submitting a
file_name.hcl.json
to atlantis, before plan and apply runs, pre-workflow-hookterragrunt-atlantis-config_1.14.2_linux_amd64 generate --output atlantis.yaml --parallel=false --autoplan --automerge --ignore-dependency-blocks=true
runs which should have generatedatlantis.yaml
, but it didn't generate any such file and when I manually ran the pre-workflow-hook command it gave error asfile_name.hcl.json:1,1-2: Argument or block definition required; An argument or block definition is required here.
content of
file_name.hcl.json
but if I run
terragrunt plan
locally in that file location it works.captured server logs from atlantis when
file_name.hcl.json
is submittedThe text was updated successfully, but these errors were encountered: