"Developer" role running the "plan" stage
We are having issues with individuals with the "Developer" role running "plan" on merge requests.
The error we get is
Acquiring state lock. This may take a few moments...
╷
│ Error: Error acquiring the state lock
│
│ Error message: HTTP remote state endpoint invalid auth
│
│ OpenTofu acquires a state lock to protect the state from being written
│ by multiple users at the same time. Please resolve the issue above and try
│ again. For most commands, you can disable locking with the "-lock=false"
│ flag, but this is not recommended.
I don;t think this error text is 100% correct as no other operations are happening at the same time on the repo, terraform state.
From our experimentation -
Users with a higher than the "Developer" role always succeed running the plan stage on merge requests. Users with the "Developer" role always fail running the plan stage on merge requests.
From my understanding tofu plan should run with the default "-lock=false" - https://opentofu.org/docs/cli/commands/plan/
The page below states the permission required to read the state files
https://docs.gitlab.com/ee/user/infrastructure/iac/terraform_state.html
To read the state by using tofu plan -lock=false, you must have at least the Developer role.`
I could read that sentence one of two ways
I am not sure if the I need to somehow force the plan stage to run with "-lock=false" or our permissions are incorrect.
"Developer" should be the correct role but most permissions settings in Gitlab are "suprising"