-
Notifications
You must be signed in to change notification settings - Fork 9.7k
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
A way to dynamically assign a local state file path #36600
Comments
Thanks @IGLADI, just updated the diagnostic message, that URL should not be there. As fas as the backend portion of the Since you can't safely access the file from multiple process concurrently, and must have some coordination around the state access, how is it that you are running terraform with |
Hey, thanks for the quick reply. Indeed, when I was talking about init I meant initialize the file, not the What I'm currently working on is a tool to automatically test your software on different platforms. And per what you say on the new local solutions: the Ps: IK there is a target flag in the terraform destroy but it makes thing dirty and complicated for nothing. |
You can't have multiple processes working on the same state file at the same time, so I'm having trouble understanding what it is precisely you are asking for Terraform to do here. If you have multiple processes working against the same state file, then it is up to you to serialize their access. Or maybe you are asking to have multiple state files representing the same managed resources? But that again is counter to Terraform's design, and will cause errors regardless of how the state files are located by the cli. I'm not sure how targeting fits in to this either, that does not affect the state, but that rather reduces the dependencies to specified resources during plan and apply. In order to accept a request for a new feature of some sort, we need a detailed workflow of how that feature is supposed to work, and how it interacts with the existing features of Terraform. Thanks! |
I’m not working with multiple processes on the same Currently, with the deprecation of the
Let me walk you through the workflow my code is trying to implement: My code creates multiple threads, say one for debian and another for ubuntu.
The key issue here is that I need a way to dynamically assign separate Feature request: It would be very helpful if there was a new way to dynamically assign different |
Thank you @IGLADI, that clears up what exactly you are requesting here 👍 |
Hello @jbardin and team, I hope you're doing well! I'm interested in this issue and would like to contribute with a solution. I see that the problem has been clarified and labeled as CLI, but there hasn’t been a confirmation yet on whether this functionality will be accepted. Before I start working on a PR, I’d like to know if this change would be welcome and if there are any specific guidelines or considerations I should follow. Looking forward to your response, and thanks in advance! |
Hi @GuiiifSouza, Unfortunately we don't have a real method for indicating when a solution is accepted, other than via open discussion. The internal roadmap is not reflected in the issue tracker, and in most cases if an open issue has an accepted solution there will already be a team member working on it. While we acknowledge that there is a problem to be solved in this issue, the deprecated flags or CLI workspaces are going to be the only solutions for now because there has been no design for a new feature to cover the exact use case. Given that a major redesign of remote state storage needs to be planned, which will inevitably include a way to parameterize any new state storage configuration, new design work will have to be included in that future project. |
Terraform Version
Use Cases
Replacing the legacy/deprecated
-state
flag: The new Data Source requires an existing.tfstate
file.Let me explain: I'm making a script that deploys multiple vms, do some tests on them and destroy's them, I have multi threaded it so I'm using multiple
.tfstates
to avoid one thread applying a destroy on everything.-state
works as I can give each thread a separate state file, however this is deprecatedPer the docs (see References) there are 2 new ways to define the path of the
.tfstate
to use:Please also read this comment for further clarification.
Attempted Solutions
Using the legacy/deprecated
-state
Proposal
A new way to dynamically assign a state path file. Like a
local_state_path
data block or smth.References
https://developer.hashicorp.com/terraform/language/backend/local (btw the deprecated warning outputs a wrong non-existing link)
The text was updated successfully, but these errors were encountered: