In my organisation , these are the current versions :
- Terraform(from 0.12 to 1.0.3)
- AWS (from 3.32 to 3.70)
and we want to perform an upgrade on terraform and aws provider version.
Terraform Backend used is S3 , terraform is running as container on ecs instances linked to jenkins agent ( jenkins slave on AWS ECS)
Can you pls suggest the foll:
-
Approach to follow for tf and aws provider upgrade , i am aware to follow this upgrade guide.
-
Do i need to create new s3 location to store the new version statefiles / in that case is backup required to maintain older state files.
Or the same previous one only should be used and no changes req .
-
Also , to upgrade the tf version , using the appropriate container image with the tf version configured can be used directly for ecs instances . Is that correct ?
-
terraform 0.13upgrade - is this required , if yes pls suggest how to use this .
Or only terrform init plan and apply will work.
Hi @radhika.obhan,
I would suggest upgrading Terraform CLI to the latest v1.1 patch release (following the steps in the various upgrade guides) before upgrading to a new version of the AWS provider. Provider packages that work on Terraform v0.12 should also work on Terraform v1.1, but newer versions of the AWS provider may not be compatible with older versions of Terraform CLI. (This is just a general statement; I don’t have any particular changes to the AWS provider in mind.)
If you have versioning enabled on your S3 bucket then new state snapshots created during upgrading will automatically preserve older snapshots, and so you should not need to take an explicit backup. However, there is no harm in taking a separate backup yourself if you wish. You should not change your backend configuration when upgrading except as required by any changes to the S3 backend itself.
I would suggest if possible to run your upgrade steps with the Terraform executable run directly from a normal shell, rather than running the upgrade process inside any sort of container. While you can in principle configure a container to make its results visible outside of the container so that you can take actions based on it, that is typically considerably more complicated than running Terraform as a local process which can act directly on local files in your verson control working tree.
If you aren’t sure whether the steps described in the upgrade guide apply to you, you should assume they do and carry them out as described. You may be able to skip some steps if the upgrade guide is describing a situation that doesn’t match your usage of Terraform, but particularly for the automated upgrade processes it’s better to run them and have the tool itself tell you that no action is required, rather than to guess and potentially miss things that will make later upgrades more difficult.
1 Like