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 is unable to destroy deleted projects #1178

Closed
chrisob opened this issue Sep 7, 2020 · 1 comment
Closed

Atlantis is unable to destroy deleted projects #1178

chrisob opened this issue Sep 7, 2020 · 1 comment
Labels
duplicate This issue is a duplicate of an already reported issue

Comments

@chrisob
Copy link
Contributor

chrisob commented Sep 7, 2020

Desired behavior
On first glance, I would expect that Atlantis is able to plan/apply a destroy for an entire project if the project files have been deleted in a PR.

Actual behavior
Atlantis is not able to destroy a project which was deleted due to the missing project directory.

Version
v0.15.0

Steps to reproduce

On master branch:

  1. Create a project in the dir myproject which defines some Terraform resources
  2. Configure autoplanner when_modified pointing to myproject in atlantis.yml
  3. Deploy myproject manually or via atlantis in a PR which is already merged to master (in other words, make sure resources exist and are in remote TF state)

In a PR/feature branch not yet merged to master:

  1. Delete entire myproject dir, commit & push to PR's feature branch

  2. atlantis plan says "0 projects are to be planned" even though myproject resources have been deleted

  3. atlantis logs say:

    2020/09/07 16:53:59+0000 [DBUG] project_finder.go:135 chrisob/my-repo#3: Project at dir "myproject" not included because dir does not exist
    

I'm guessing that Atlantis only looks at the feature branch's tree to discover project info/remote state, so if the project dir no longer exists on the feature branch, then Atlantis wouldn't be able to plan against a remote state, which would explain this issue.

That being said, Atlantis is able to manage destruction of individual resources inside a project, so I'd hoped it would be possible to also delete entire projects.

Is this possible without a large refactor to do a comparison using the base branch's remote state?

@lkysow
Copy link
Member

lkysow commented Sep 8, 2020

Hi, I think this is a duplicate of #941?

Is this possible without a large refactor to do a comparison using the base branch's remote state?

We might be able to detect a directory being deleted from the list of modified files but the large piece of work would then be cloning the base branch and running terraform destroy in that directory. Right now Atlantis always clones the PR branch.

Please direct further discussion onto the original issue.

@lkysow lkysow closed this as completed Sep 8, 2020
@lkysow lkysow added the duplicate This issue is a duplicate of an already reported issue label Sep 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue is a duplicate of an already reported issue
Projects
None yet
Development

No branches or pull requests

2 participants