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

Question on state? #131

Closed
alistar79 opened this issue May 24, 2018 · 5 comments
Closed

Question on state? #131

alistar79 opened this issue May 24, 2018 · 5 comments

Comments

@alistar79
Copy link

With atlantis what is the preferred way of handling state?

We have a team of 3 here and would like to use this to centralise Terraform for us. I was of the understanding it's bad form to check in a terraform.tfstate file to repo so we have been excluding them which means we can't apply plans others have already worked on applying previously or our imported state. I was looking at Atlas that handles this for you as remote state when I spotted atlantis and assumed it would create and hold it's own state locally as local state but I can't find this anywhere? I was going to push our state files into that structure. Do we need to setup remote state provider and which is recommended with atlantis?

Many thanks in advance!

@psalaberria002
Copy link
Contributor

You should definitely use remote state.

@alistar79
Copy link
Author

Thanks @psalaberria002 I will look at this maybe a different bucket/folder per each environment we have in our repo as we template off a template environment and don't think we have updated all the resource names in each env to be unique.

@psalaberria002
Copy link
Contributor

I would recommend having multiple states. Per environment and service for example.
Add something like this to each folder you wanna have a state for.

terraform {
  backend "gcs" {
    project = "<your-project>"
    bucket = "<yourbucket-for-states>"
    prefix = "<your-env>/<service>"
    credentials = "<path-to-credentials>"
  }
  required_version = "~> 0.11"
}

@lkysow
Copy link
Member

lkysow commented May 24, 2018

Hey Alister,

I would echo the suggestion to use remote state. Then when atlantis runs terraform apply, the remote state will be updated. You're correct in that you'll want a different location to store your state per environment otherwise you'd run into issues. If you're fully separating environments (i.e. separate accounts even) then a separate bucket might make sense. Otherwise just top-level folders per env should be fine like in the example above.

This isn't related to Atlantis but I'd also recommend that you make your remote state path match the paths in your repo so it's easy to know how to reference a remote state from a different directory.

@alistar79
Copy link
Author

cheers for the advice we are going to try to use our proget servers via a http remote and differing path! fingers crossed :) I will match the path to repo path as u suggest

@lkysow lkysow closed this as completed May 24, 2018
jamengual pushed a commit that referenced this issue Nov 23, 2022
* So for whatever reason tf show with big plan doesn't work in async

* rename isValidCommand to isAsyncEligibleCommand
meringu pushed a commit to meringu/atlantis that referenced this issue May 29, 2023
New parsing of comments. Accept all flags. Fixes runatlantis#129
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

3 participants