Hey guys, I’ve got an error on my terragrunt code ...
# help
p
Hey guys, I’ve got an error on my terragrunt code and infracost because of an incomplete dependency.
Copy code
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
Copy code
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
w
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 @mysterious-teacher-68276 has a better suggestion for this specific issue though.
m
hey @polite-engineer-31217, 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
i’d recommend subscribing to this issue: https://github.com/infracost/infracost/issues/1844 for any future updates regarding Terragrunt and mock_output support
p
Awesome, thank you, I’ll generate the plan JSON.
w
@polite-engineer-31217 I was chatting with @little-author-61621 and @mysterious-teacher-68276 - we’re just wondering if you can possibly confirm if https://github.com/infracost/infracost/issues/1844 is still an issue for your setup on CLI v0.10.15?
@polite-engineer-31217 I saw the emoji response and just wondered if you had a chance to check this?
p
Sorry, I updated my docker image with infracost 0.10.15 but I haven’t tested it yet