-
-
Notifications
You must be signed in to change notification settings - Fork 5.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
Add Terraform State Locking/Unlocking Support for Gitea #33277
base: main
Are you sure you want to change the base?
Conversation
Amazing! Thanks! I haven't looked at the code yet, but I was thinking about this the other day so it's very exciting that you were working on this. |
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
CI status seems related:
|
Yes, I’m not a programmer and I'm having difficulties with the tests. I haven't been able to figure out what's wrong yet. |
That's quite alright:) If you need any pointers, or have any questions about the codebase please feel free to ask and we'd love to help. Definitely appreciate that you added tests <3 |
Summary
This PR introduces a new functionality to Gitea's package management system, enabling the use of Terraform state locking and unlocking. The integration is designed to allow Terraform to manage the state of resources stored in Gitea, ensuring that multiple users cannot modify the same state file simultaneously.
Background
To support Terraform's
state
commands (such asterraform plan
,terraform apply
, etc.) in a collaborative environment, it's essential to ensure that state files are locked when being updated and unlocked when the operation is complete. This PR allows Gitea to serve as a backend for Terraform's state management system, implementing these critical features.Key Features
terraform init
andterraform state
commands to interact with Gitea as a backend for state management.Changes
Lock and Unlock APIs:
POST
) and unlocking (DELETE
) state files.Terraform Configuration:
Terraform Configuration Example
The following configuration demonstrates how to set up Terraform to use Gitea for state locking and unlocking:
Configuration Breakdown
POST
) to use for acquiring the lock.DELETE
) to use for releasing the lock.Benefits
Testing
Additional Notes
Reviewers
Please provide your feedback or approval for merging this new functionality into the Gitea codebase.