Search code examples
amazon-web-servicesjenkinsterraform

Terraform version error when deploying to AWS through jenkins?


I was deploying using terraform through Jenkins Terraform v0.10.7. After a success deployment from my local machine using Terraform v0.11.1, I can not do it again from Jenkins, I have this error :

Terraform doesn't allow running any operations against a state
that was written by a future Terraform version. The state is
reporting it is written by Terraform '0.11.1'.

Solution

    • Using v0.11.1 run: $ terraform destroy
    • Remove the .tfstate file
    • Using v0.10.7 (or any version you want to use from now on), run: $ terraform apply