We are running terragrunt / terraform with latest GCP providers. We use and ONLY use the terraform resources directly, no third party modules are in use.
The terraform versions are:
terraform: 0.12.31 (the latest one in 0.12.x series)
Now we are planning to upgrade to latest 1.2.x version, is there a path to upgrade from 0.12.31 to 1.2.x directly, without going through 0.12.31 → 0.13 → 0.14 → 0.15 → 1.0 → 1.1 → 1.2?
If not, what will be the major intermediate terraform(and terragrunt) version(s) we have to upgrade to? Thanks a lot.
You can find the official upgrade recommendations in the Terraform v1.0 Upgrade Guide. Since all of the v1.x releases are subject to Terraform v1.0 Compatibility Promises, you can safely jump directly to the latest 1.x release instead of using v1.0.0, but you should still complete all of the described steps leading to that point.
Terragrunt is a third-party project, so I cannot say for certain which Terragrunt versions are compatible with which Terraform versions, but I’ve not previously heard anyone report needing to upgrade Terragrunt at the same time as Terraform once they have a new enough Terragrunt to work with Terraform v0.12.
You absolutely have to upgrade from 0.12 → 0.13 first, because there were changes to how providers were represented in Terraform states which only 0.13 knows how to properly migrate.
The HashiCorp docs claim you have to go 0.13 → 0.14 but I couldn’t find any specific changes that would enforce that, so I suspect it was left in the upgrade guide unnecessarily, out of an abundance of caution. I chose to dismiss it and met with success jumping from 0.13 → 1.0.
If you don’t want to do that, jumping from 0.14 → 1.x is explicitly allowed by the upgrade guides, so long as you pay attention to everything documented in all the relevant steps.
Terraform v0.14 doesn’t have any helper command to use as part of upgrading, so indeed it is possible in principle to skip that version when upgrading.
The v1.0 upgrade guide is written the way it is because both the dependency lock file and the more accurate analysis of sensitive values are potential stumbling points when upgrading and giving a recommendation to skip that version seems to be interpreted by some readers as saying that there is no need to read the v0.14 upgrade guide, which can then lead to running into problems the guide already addresses.
If you do choose to skip v0.14 then, do still be sure to read the upgrade guide for that version in case some of the situations in there apply to you. Everything the upgrade guide says about v0.14 applies to later versions too, so you can take the same actions described there even if you are already using a v1.x release.