robburger / terraform-pr-commenter

A GitHub Action that adds opinionated comments to a PR from Terraform fmt/init/plan output
MIT License
129 stars 63 forks source link

update parsing for terraform v0.14 #3

Closed xinluh closed 3 years ago

xinluh commented 3 years ago

Prior version of terraform plan output something like

<...>
some_resource: Refreshing state... [id=some_resource]

------------------------------------------------------------------------

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  ~ update in-place
  - destroy
<...>
------------------------------------------------------------------------

But latest terraform no longer output the first ------ line:

<...>
some_resource: Refreshing state... [id=some_resource]

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  ~ update in-place
  - destroy
<...>
------------------------------------------------------------------------

So the parsing strips all the actual diff.

This PR fixes the parsing by stripping out the lines containing Refreshing state... instead of looking for content between the ---- lines.

robburger commented 3 years ago

Thanks @xinluh 🙌 I'll merge this in to the base branch now. I have a few other changes I'd like to get in before moving the v1 tag on the action, but it should be in the next few days!