I manage around 25 pipelines with different TF versions (0.11, 0.12, 0.13, 0.14). As a backend for storing the Terraform states I use Artifactory.
Within the pipeline I have env-a and env-b.
The TF run will run in env-a and push the state to folder env-a in Artifactory.
When all the inspec is correct I download the state from folder env-a and upload it to env-b.
This used to work just fine, however from some reason it started to fail in multiple pipelines randomly. These pipelines use different Terraform versions and sometimes also different providers (vsphere, azurerm).
The command that fails:
- …/env-a/terraform state push -force terraform.tfstate
An example of an error that I get:
e[31mFailed to write state: cannot overwrite existing state with serial 34 with a different state that has the same seriale[0me[0m
Looking at this it seems like it doesn’t increase the serial but it also ignores the -force flag that I give to push.
Did anyone experience this before?