Terraform state push question

We store our terraform projects in gitlab and states with a gitlab backend. Someone deleted the state. We recovered the state to a json file via shapshot of our gluster backend. How do I restore the state to gitlab? i’ve got the state i want to recover in a json file.

I’ve tried following this link with no success.

I’ve also seen a post about using the ‘Copy terraform init command’ from the project state page on gitlab and running

terraform state push /path/to/terraform.tfstate -force 

and this didnt work. I’m doing this from a workstation that does not have a copy of the config files, just the recovered json file.

Any guidance would be greatly appreciated.

I figured it out.

I created a branch on the local vscode of the project, copied the restored state file to directory that has the main.tf file named as ‘terraform.tfstate’.

Then i ran the init command from the “copy terraform init command” from the gitlab state page of the project.

It asked if i wanted to copy new state to new backend, typed yes and its restored.