mercari / tfnotify

A CLI command to parse Terraform execution result and notify it to GitHub
MIT License
619 stars 91 forks source link

Error while parsing the output only changes for Terraform `>=0.15` #108

Closed KeisukeYamashita closed 2 years ago

KeisukeYamashita commented 2 years ago

WHY

From Terraform >= 0.15, if there no changes in the resources but changes on the output only, Terraform will only print

Changes to Outputs:

Steps to reproduce

Plan

>= 0.15 Plan result

I used the v1.1.4 Terraform version.

$  terraform plan

Changes to Outputs:
  + slack = "hoho"

You can apply this plan to save these new output values to the Terraform state, without changing any real infrastructure.

< 0.15 Plan result

I used the v0.14.10 Terraform version.

$ terraform plan

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:

Terraform will perform the following actions:

Plan: 0 to add, 0 to change, 0 to destroy.

Changes to Outputs:
  + slack = "hoho"

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

Note: You didn't specify an "-out" parameter to save this plan, so Terraform
can't guarantee that exactly these actions will be performed if
"terraform apply" is subsequently run.

Apply

>= 0.15 Plan result

I used the v1.1.4 Terraform version.

$  terraform apply

Changes to Outputs:
  + slack = "hoho"

You can apply this plan to save these new output values to the Terraform state, without changing any real infrastructure.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

Apply complete! Resources: 0 added, 0 changed, 0 destroyed.

Outputs:

slack = "hoho"

< 0.15 Apply result

I used the v0.14.10 Terraform version.

$  terraform apply

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:

Terraform will perform the following actions:

Plan: 0 to add, 0 to change, 0 to destroy.

Changes to Outputs:
  + slack = "hoho"

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

Apply complete! Resources: 0 added, 0 changed, 0 destroyed.

Outputs:

slack = "hoho"
KeisukeYamashita commented 2 years ago

Raised a PR https://github.com/mercari/tfnotify/pull/109