ahmadnassri / action-terraform-report

Updates Pull Requests with visual diff of Terraform Plan changes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Not showing correct plan details on header

rr-krupesh-savaliya opened this issue · comments

Issue: Show the wrong plan in header details.

Screenshot 2022-09-15 at 12 09 44 AM

As you can see above, add value is 3, and destroy value is 4. but the actual plan details are as per below.

Screenshot 2022-09-15 at 12 11 30 AM

Thanks

interesting... can you grab the json object and see what it says?

this value comes straight from the json data generated by the plan

I can't show all terraform plan. but In the plan, these 3 actions are included.

Screenshot 2022-09-16 at 12 25 07 AM

Action Counts:

create(+) = 3
destroy and create(-/+) = 4
create and destroy(+/-) = 1

So, total 7 to add and 5 to destroy.

This will help you to reproduce the issue.

Thanks

I think I found the issue, it's here: https://github.com/ahmadnassri/node-terraform-unidiff/blob/a54705ee0aa6c2751cde40c0b23f08678c082f85/index.js#L38-L43

and according to the terraform docs: https://www.terraform.io/internals/json-format#change-representation

Valid actions values are:
  //    ["no-op"]
  //    ["create"]
  //    ["read"]
  //    ["update"]
  //    ["delete", "create"]
  //    ["create", "delete"]
  //    ["delete"]

I clearly wasn't taking into account the two scenarios of ["delete", "create"] and ["create", "delete"] ...

fix will be up shortly, thanks for your help!

fix should be released in v3.1.5

please let me know if it's working for you.