I decided to try using Gitlab as a backend for Terraform. For one reason or another, I needed to manually remove something from my state because it was breaking my CI pipeline. So from my command line, I run
terraform state rm the_resource.my_resource.
Problem: I am running Terraform 0.12.29 locally, but the
latest Terraform container image for GitLab CI is Terraform 0.12.28. (I could try to use someone else’s container image, but then the tail is wagging the dog–the point was to make things simpler!) Anyway, after I do that, the pipeline begins failing with a much more problematic message:
Error: Error loading state: state snapshot was created by Terraform v0.12.29, which is newer than current v0.12.28; upgrade to Terraform v0.12.29 or greater to work with this state
Well, I can’t do that! So I decide, “whatevs, let me just delete the state file.” And then I realize I have no idea how to do that, either, since I have only interacted with it via API. The only thing I can think of, aside from giving up on the GitLab Terraform backend, is deleting the repository and starting over. That is not a palatable option.
Is there another way to reset the backend state?