Title
#help
s

Sylvain Witmeyer

10/14/2022, 4:16 AM
Hey guys, I’ve got an error on my terragrunt code and infracost because of an incomplete dependency.
Error: Failed to parse the Terragrunt code using the Terragrunt library:
...
terragrunt.hcl:16,70-73: Invalid index; This value does not have any indices.
This input is
subnet_id : dependency.legacy_datasource.outputs.private_subnet_ids[0]
So I was thinking about using
mock_outputs_allowed_terraform_commands = ["validate"]
  mock_outputs = {
    vpc_id = "fake-vpc-id"
  }
but I don’t know what tf_commands should I use since you’re using the parsing library ? Thank you for your suggestions
Ali (Infracost)

Ali (Infracost)

10/14/2022, 5:53 AM
Good question! Generally speaking if parsing HCL doesn’t work for a use-case we suggest generating a plan JSON and using that. This docs section describes the method for Terragrunt, which as you can see is a bit long-winded. Maybe @Hugo (Infracost) has a better suggestion for this specific issue though.
Hugo (Infracost)

Hugo (Infracost)

10/14/2022, 6:46 AM
hey @Sylvain Witmeyer, Ali’s suggestion using the plan JSON method is, unfortunately, the way to go. We currently don’t support
mock_outputs
using the HCL parsing with terragrunt. Let us know if you have any further questions
8:54 AM
i’d recommend subscribing to this issue: https://github.com/infracost/infracost/issues/1844 for any future updates regarding Terragrunt and mock_output support
s

Sylvain Witmeyer

10/14/2022, 12:11 PM
Awesome, thank you, I’ll generate the plan JSON.