terraform-github-actions icon indicating copy to clipboard operation
terraform-github-actions copied to clipboard

Ignore deprecation warnings in plan comparison?

Open bamarch opened this issue 5 months ago • 6 comments

Suggestion

Hi Dan - thanks for the TF action, since working together I've brought it along with me to new gigs :D

The feature to compare PR plans when applying provides a lot of value.

Recently though I have had some terraform-apply failures due to changed from the plan on the PR

The plan is the same, apart from a snippet after the summary that says "Warning: Argument is deprecated"

Image

For the same HCL and the same terraform state, the warning from the PR plan has chosen a resource with uks in the name whereas the apply on merge has chosen a resource with eus in the name for its example.

Unfortunately warnings are not deterministic in their choice of example resource: https://github.com/hashicorp/terraform/issues/30934

Suggestion:

Could the warnings section be ignored when comparing plans?

The content after the summany Plan: 26 to import, 0 to add, 1 to change, 0 to destroy. doesn't relate to actions that will be taken during an apply of the plan, so I think should be safe to omit from comparisons

bamarch avatar Aug 08 '25 08:08 bamarch

There also potentially something going on with the (5 unchanged attributes hidden) line

The comment posted to the PR has the # as the first character of the line

Image

Perhaps it is being omitted / seen as a comment when doing the comparison?

Doing a side-by-side of the output in the GHA logs, the # character is in the same place for both the PR plan and the apply


PR plan output

Image

Apply output

Image

bamarch avatar Aug 08 '25 08:08 bamarch

Using version 1.49.0 of terraform-plan and terraform-apply

bamarch avatar Aug 08 '25 08:08 bamarch

Hi Ben 👋 I'm glad you're finding these actions useful ❤️

The warnings should be being stripped out, but that doesn't seem to be working. Everything after the Plan: line should be ignored, but 26 to import is preventing it from being recognised. The unchanged attributes also should be being stripped out, but the changing # position is preventing that.

I think I can fix this soon

dflook avatar Aug 08 '25 09:08 dflook

Ahh ok makes sense it is the edge case combination of deprecation warnings and doing imports together - thanks for the lightning fast reply

bamarch avatar Aug 08 '25 09:08 bamarch

This should be resolved in v2.2.2

There was a small issue with # in the changes summary when the plan has actually changed, but that was resolved last week in v2.2.1

dflook avatar Aug 08 '25 13:08 dflook

Thanks @dflook!

bamarch avatar Aug 08 '25 13:08 bamarch