You want to upgrade terraform from v0.13 to v1.0.0. Made changes to versions.tf. Also, you use different workspaces for storing state files.
When the pipeline is run, it validates and inits fine but fails with an error during plan-
–> Ensure you have the required terraform version installed. Say, want to upgrade to v1.0.0 then it should be installed
–> Change directory to terraform folder where all tf files are available.
–> terraform init
–> terraform workspace select <REPLACE WORKSPACENAME>
–> terraform workspace show [This is to confirm that you are in the right workspace]
–> Run this command
terraform state replace-provider “registry.terraform.io/-/aws” “registry.terraform.io/hashicorp/aws”
It will show a screen like below and will make changes only if enter yes.
It will prompt to say YES to update. Review the changes and update.