Terraform lock state API returns 500 error on curl
Summary
Running a request via curl to lock the terraform state that is mentioned in our Remove a state file documentation returns a 500 error.
Steps to reproduce
- Try to lock the state file via the curl command (
curl -X POST -H "Private-Token: $TOKEN" https://gitlab.com/api/v4/projects/<YOUR-PROJECT-ID>/terraform/state/<YOUR-STATE-NAME>/lock) - See 500 error
Example Project
https://gitlab.com/gitlab-gold/faleksic-tests/private-group/terraform-state-testing (note: its a private project)
What is the current bug behavior?
A 500 error is returned.
What is the expected correct behavior?
400 Bad Request
Relevant logs and/or screenshots
Kibana Logs (Internal only) Sentry Logs (Internal only)
Output of checks
This bug happens on GitLab.com
Results of GitLab environment info
Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of: `sudo gitlab-rake gitlab:env:info`) (For installations from source run and paste the output of: `sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)
Results of GitLab application Check
Expand for output related to the GitLab application check
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:check SANITIZE=true)(For installations from source run and paste the output of:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)(we will only investigate if the tests are passing)
Possible fixes
The line that returns the error is - https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/api/validations/validators/limit.rb#L10
More information is in the Sentry logs.