Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Atlantis plan with terraform 1.4.0 returns zero output when nothing is changed #3200

Closed
adriantr opened this issue Mar 10, 2023 · 9 comments
Closed
Labels
bug Something isn't working

Comments

@adriantr
Copy link

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request. Searching for pre-existing feature requests helps us consolidate datapoints for identical requirements into a single place, thank you!
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Overview of the Issue

Atlantis plan doesn't seem to pick up the last line of plan output which contains info about nothing being changed.
image
image
image

Reproduction Steps

Logs

Environment details

Additional Context

@adriantr adriantr added the bug Something isn't working label Mar 10, 2023
@AlessioCasco
Copy link

This is an intentional change in terraform 1.4.0

The Terraform plan renderer has been completely rewritten to aid with future Terraform Cloud integration. Users should not see any material change in the plan output between 1.3 and 1.4. If you notice any significant differences, or if Terraform fails to plan successfully due to rendering problems, please open a bug report issue.

If you have specified a different terraform version in Atlantis, it may be that you are also affected by #3199 where latest seems to be always used.

@nitrocode nitrocode changed the title Atlantis plan doesn't return any output anymore when nothing is changed Atlantis plan with terraform 1.4.0 returns zero output when nothing is changed Mar 10, 2023
@wyardley
Copy link
Contributor

This also seems to create a single empty line diff vs. "no changes", at least with one provider we use
image

@wyardley
Copy link
Contributor

wyardley commented Mar 10, 2023

Based on hashicorp/terraform#32815, hashicorp/terraform#32822 seems to have a fix

@wyardley
Copy link
Contributor

Maybe Atlantis should use something else to see if the plan had any changes, whether that's returning a generic message if there's no diff and / or if the exit code shows no changes, or chomp off that trailing newline at least and use that to figure out if there are changes?

It does look like the CLI will exit 0 if no changes, or non-zero otherwise if -detailed-exitcode is used, so that might be the most reliable way to figure out if there are changes or not?

@nitrocode
Copy link
Member

Thanks for adding those tickets. Hopefully this will be released soon in 1.4.1.

We currently use a set of regex to determine no changes if I recall correctly. Perhaps using the exit code would work. Unsure how that exit code has changed across different terraform versions though.

@wyardley
Copy link
Contributor

I don't remember exactly, but had the zip of 0.12 locally, and that's got the same info:

  -detailed-exitcode  Return detailed exit codes when the command exits. This
                      will change the meaning of exit codes to:
                      0 - Succeeded, diff is empty (no changes)
                      1 - Errored
                      2 - Succeeded, there is a diff

So I'm guessing that goes relatively far back, and is probably as stable or more stable than looking at the output.

@nitrocode
Copy link
Member

Does 1.4.1 fix this issue?

Let's see if that fixes it before looking into the exit code

@wyardley
Copy link
Contributor

Confirmed 1.4.1 resolves the issue

@nitrocode
Copy link
Member

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants