Unlock state using a shell file

I’m using terraform and I have a state of a branch blocked.
I don’t have access to the Terraform CLI and the template files used and I can’t unlock it manually from the infrastructure page.
I read that from a new branch I can run a file to unlock the state using a shell file with

terraform force-unlock id

My questions are: How can I run this code? I need to put it in a job? And where? (in the .gitlab-ci.yml file?)