I’ve a pipeline with three stages which runs terraform. Each stage has a remote statefile. stage 2 reads from the stage 1’s remote state and stage 3 reads remote state from stage 1 and 2.
I experimented a little and came to the understanding :
- Terraform of higher version can read the statefile of lower version and not vice versa.
- Terraform of higher version can update it’s statefile of lower version without version conflict.
So, my thought of upgrading the terraform in my pipeline is in reverse order. i.e., Stage 3 > Stage 2 > Stage 1 with a dummy terraform apply, so that in each stage new version of terraform can update it’s state and can still read the previous stage’s statefile.
Is there any alternatives/better way of doing this ?
Thank for the awesome community and help.