-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
Feature request: allow manual remote state locking #17203
Comments
Hi @2rs2ts, When planning the implementation for state locks, we made the decision to not handle this particular use case. If desired, options like this can be provided by external automation and workflow systems. The In practice, many backends may not even support maintaining a lock on a state without the command running. For example, in consul the lock is tied to the calling process being responsive, so the lock is released as soon as the terraform process exits. |
Hi, those who need I know Terraform doesn't provide In team development, Terraform configurations are generally managed by VCS such as git, and states are shared via a remote state storage which outside of version control. Most Terraform refactorings require not only configuration changes but also state manipulations such as state mv / rm / import. It is not desirable to change state before merging configuration changes. My colleague may be working for another task. I don't want team members to change the state during refactoring to avoid unexpected conflicts. So I wrote an unofficial tool for locking Terraform state manually. Currently, it is tested only with Terraform 0.12 + AWS S3 (locked with DynamoDB). Thanks! |
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. |
Currently, backend providers can implement locking during operations that can write state. This happens automatically. And there is a
force-unlock
command for when things go wrong.A command for manually locking without running an operation that can write state would be useful. If your backend supports it, it would write the lock but do nothing to the state. Perhaps a command to remove that manual lock would be useful as well.
The text was updated successfully, but these errors were encountered: