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

Where are .tfstate and .tfstate.backup stored? #207

Closed
ghost opened this issue Nov 27, 2017 · 3 comments
Closed

Where are .tfstate and .tfstate.backup stored? #207

ghost opened this issue Nov 27, 2017 · 3 comments

Comments

@ghost
Copy link

ghost commented Nov 27, 2017

Hi,

I am testing on atlantis but unfortunately I messed up the whole region. How do I call terraform destroy in atlantis? Or, if I have to call that from the host machine, where are .tfstate and .tfstate.backup stored?

Currently I have to open another region aws console, check which resources should not exist and delete them all.

@lkysow
Copy link
Collaborator

lkysow commented Nov 28, 2017

@minghsieh-prenetics are you using local state? If you're using remote state then your state will be wherever it's configured to be. Atlantis should only be used with remote state because otherwise your state needs to be checked into the repo which Atlantis can't do for you.

See https://www.terraform.io/docs/state/remote.html

To answer your question, Atlantis checks out your repo to ~/.atlantis/repos/{owner}/{repo}/{pullRequestNum}/{workspace}. If you're using local state then the .tfstate files should be in there.

@ghost
Copy link
Author

ghost commented Nov 28, 2017

Well, I just try again with standard ./atlantis bootstrap cmd. It turns out the terraform state stored in /tmp/atlantis/data/repos/<github username>/atlantis-example/<pull req number>/<env>/<env>/terraform.tfstate.d/<env>/terraform.tfstate. I accidentally got this due to click the conflict PR (e.g. Plan Failed: This project is currently locked by #1. The locking plan must be applied or discarded before future plans can execute). Thanks anyway.

@ghost ghost closed this as completed Nov 28, 2017
@lkysow
Copy link
Collaborator

lkysow commented Nov 28, 2017

ahh okay, let me know if you run into anything else!

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant