Terraform Providers Version Upgarde Process | Regarding Best Practice / Process / Approaches?

Hello There,

Happy New Year. Hope you are all well and in sound health and had a great start to your new year.

I am writing this email to seek your support for Terraform Providers Version Upgrade.

We currently have Terraform AWS Provider v3.41.0 which we want to upgrade to the latest stable v4.x.x. We are currently following the below steps as per the terraform documentation:

  • Need to update to the latest v3.x.x then proceed to upgrade to version 4.
  • Updating the “AWS provider” section in the “providers.tf” file to version = “~> 3.75.2”
  • Execute “terraform init -upgrade”
  • Execute “terraform plan” & based on the errors/warnings received in the plan we try to resolve those issues by refactoring our code in alignment with terraform documentation.
  • As not all warnings/errors are shown at once we fix the current ones & then only new ones get revealed. So, after the currents are resolved we execute the “terraform plan” again to see
    • if all are resolved?
    • do we have new errors?
  • Once all are resolved we apply those changes & the same cycle gets repeated again as some new warnings/errors pop up that weren’t shown in terraform plan.
  • After performing these above steps till v3.75.2 we will need to repeat the whole process again for the transition to v4.x.x.

Since we have a fairly large code base in which there are multiple modules & is also tightly coupled with ansible this process is taking a lot of time.

Also, we are not able to quantify the effort that will go into it due to the uncertainty of “if we will get new warnings/errors or not after resolving the current ones.”

We just wanted to know if there is a better more optimized way to do the same. What does terraform recommend here as a best practice?

I believe this is a common use case and multiple organizations might have reached out to you for the same. We did explore/researched approaches around it but everybody suggested this is the only way.

Hope to hear from you soon regarding the same. Thanks :slight_smile: