Skip to content

Atlantis tries to plan an empty directory when moving to contents to a different directory #5511

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

Open
nitrocode opened this issue Apr 10, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@nitrocode
Copy link
Member

nitrocode commented Apr 10, 2025

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

I noticed that when migrating files into a subdirectory such as parent/*.tf to parent/subdir/*tf, it will try to plan the empty parent/ dir even though there aren’t any matching *.tf files and fail to plan. Anyone know of a configuration fix for this or is this a bug?

To get around this, I’m thinking of updating the workflow to check if the directory is empty before the init workflow and if it is, just do an early exit 0

This issue makes refactoring more difficult.

Reproduction Steps

  1. Find a directory of terraform files e.g. parent/*.tf
  2. Create a new directory within that directory parent/subdir
  3. Move the contents of parent/*.tf to parent/subdir
  4. Create a PR

Atlantis will try to plan both parent/ and parent/subdir. The latter will succeed and the former will fail because there are no terraform files here.

Logs

Environment details

Additional Context

@nitrocode nitrocode added the bug Something isn't working label Apr 10, 2025
@darrylweaver
Copy link

darrylweaver commented Apr 17, 2025

We have also hit this issue. We tried to work around it by creating a new folder in a separate PR and applying that first, then creating a 2nd PR that deletes the old directory, but the problem persists with the deletion of the existing directory. We have the ability to emergency merge a PR into the protected main branch, but only if the checks all pass and so Atlantis itself is blocking the emergency merge.

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

2 participants