atlantis
atlantis copied to clipboard
Ignore empty plans on apply
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.
- [ ] I'd be willing to implement this feature (contributing guide)
As a repository maintainer with hundreds of projects, I would like atlantis apply to ignore projects with no changes found during plan.
Specifically, I would like:
- (auto)plan to continue to include all projects, even those with no changes
atlantis applyto only apply projects with planned changesatlantis apply -p <project>to only apply the specified project
The primary drawback of this approach is that side-effecting applies which would otherwise be run, despite having no changes visible to Terraform, would no longer be run. Perhaps this should be an opt-in feature?
Our primary alternative is to run targeted applies on the projects with changes. However, if ~10 projects have changes out of ~200 total projects, even running targeted applies can take a long time. Less time than applying all 200, but more than just writing atlantis apply.
Dear bot, please unstale this. I've got the very same need. The only aspect I'm worried about is upgrading terraform from some very old version (like 0.11 to 1.), which requires several jumps, and applies in the middle even if plan is up-to-date, so that terraform applies some migrations to the state. But because we've got a guarantee for terraform 1., I'd be ok with doing these upgrades semi-manually or temporarily disabling this feature, while having requested feature enabled day-to-day.
So there is detailed-exitcode both in terraform for some time now:
https://developer.hashicorp.com/terraform/cli/v1.1.x/commands/plan#detailed-exitcode
and also terragrunts now propagates this correctly: https://github.com/gruntwork-io/terragrunt/releases/tag/v0.69.1
So atlantis could add extra flag, which ignores empty plans by checking exit code from plan. If it is equal 0 - just ignore/remove plan. And do not post long comment in the PR. Single sentnce like (Plan up to date) would be fine though. Right now when the plan is clean, we're still getting the default atlantis message with all the instructions about plan/apply...