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

Do not store config in state #7179

Closed
raphink opened this issue Jun 15, 2016 · 6 comments
Closed

Do not store config in state #7179

raphink opened this issue Jun 15, 2016 · 6 comments

Comments

@raphink
Copy link
Contributor

raphink commented Jun 15, 2016

Terraform Version

v0.6.16

Expected Behavior

Config and state should be stored in separate files for idempotency reasons. This would save users from having to write Makefiles and such to manage remote state configs.

Actual Behavior

Remote config and state are stored in the same terraform.tfstate file, mixing configuration and data.

@raphink
Copy link
Contributor Author

raphink commented Jun 15, 2016

I traced this to https://github.com/hashicorp/terraform/blob/master/command/state.go#L212, where the Terraform state object is passed to remote.NewClient.

@apparentlymart
Copy link
Contributor

This seems somewhat related to #1964. Perhaps if we were to address #1964 (move the remote configuration into the main Terraform config, rather than having it be a separate thing to set up) this would address your concern, @raphink?

@raphink
Copy link
Contributor Author

raphink commented Jun 15, 2016

Yes and no. For the use case I have now, we are indeed using a single S3 bucket with a varying path per terraform root, but there could be cases where we'd want to use different S3 buckets (because different projects might use different AWS accounts).

@jen20
Copy link
Contributor

jen20 commented Jun 17, 2016

Hi @raphink! I'm not entirely certain of the idempotency benefit that would be brought by this - can you (or perhaps @apparentlymart) elaborate a bit on your suggestion of what information would be added to and removed from the various files involved?

@apparentlymart
Copy link
Contributor

Hi @raphink! Sorry for the long silence here.

Back in Terraform v0.9 we did indeed split these two artifacts by making the .terraform/terraform.tfstate file only include the backend configuration (the filename was retained for compatibility purposes, even though it's not really a "state" anymore) and keeping the state data itself only in the remote data store.

We missed this on previous update passes because it was labeled in and old way that our filters didn't catch. Sorry about that!

@ghost
Copy link

ghost commented Mar 31, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Mar 31, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants