I recently ran into this same issue and decided to update this thread with my findings, as its one of the only ones that came up when I performed a very-specific google search for my problem (displaying terraform plan reports in merge requests when running terragrunt in a monorepo).
Here's the line in my gitlab-ci.yml
that performs the plan (actually multiple plans in various submodules):
terragrunt run-all show --json $PLAN 2>/dev/null | convert_report >> $JSON_PLAN_FILE
Notes:
- I copied
convert_report
straight from Gitlab's terraform report artifacts docs
2>/dev/null
was necessary to get rid of all the terragrunt
output (and only display the terraform
json output that feeds into jq
Then I had to do some massaging in python to format it into the output Gitlab expects:
{
"create": 0,
"update": 0,
"delete": 0
}
The python massaging is also required to combine these values and separate them into logical chunks (arbitrary, based on what I want to group by) so that they can be presented as separate resources in merge requests
Hope that helps the next weary internet traveler that stumbles upon this post save some time :)