简体   繁体   English

通过 jenkins 部署到 AWS 时出现 Terraform 版本错误?

[英]Terraform version error when deploying to AWS through jenkins?

I was deploying using terraform through Jenkins Terraform v0.10.7 .我正在通过 Jenkins Terraform v0.10.7使用 terraform 进行部署。 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 v0.11.1从我的本地机器成功部署后,我无法从 Jenkins 再次执行此操作,出现此错误:

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'.
  • Using v0.11.1 run: $ terraform destroy使用 v0.11.1 运行: $ terraform destroy
  • Remove the .tfstate file删除.tfstate文件
  • Using v0.10.7 (or any version you want to use from now on), run: $ terraform apply使用 v0.10.7(或您想从现在开始使用的任何版本),运行: $ terraform apply

If you are using TFE maybe you can re-queue the previous state created with 0.11.x.如果您正在使用 TFE,也许您可​​以重新排队使用 0.11.x 创建的先前状态。 Or perhaps you can look in Jenkins history to get the last state created with 0.11.x.或者,您可以查看 Jenkins 历史记录以获取使用 0.11.x 创建的最后一个状态。

A colleague of mine, Manuel Sierra has bumped into this error and concluded with the following solution: (Be careful with the following, it is going to give version errors if you happen to downgrade to another version incompatible with the code)我的一位同事 Manuel Sierra 遇到了这个错误,并得出了以下解决方案:(请注意以下内容,如果您碰巧降级到与代码不兼容的另一个版本,则会出现版本错误)

In our case, downgrade from 0.11.14 to 0.11.13 yielded no errors.在我们的例子中,从0.11.14降级到0.11.13没有产生错误。

  1. Execute terraform pull state > current.state执行terraform pull state > current.state
  2. Modify the version with the one executed by you用你执行的那个修改版本
  3. Execute terraform push state current.state执行terraform push state current.state

Now you are good to go with the downgraded version.现在您可以使用降级版本了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 通过 terraform 部署 AWS WorkSpaces 时出现 ValidationException 错误 - ValidationException error when deploying AWS WorkSpaces via terraform 通过jenkins Job使用Terraform在AWS中自动创建基础架构 - Automate creating infrastructure in AWS using Terraform through jenkins Job terraform 基础设施在本地运行,在 aws 代码管道上构建和部署它会出错 - terraform infrastructure runs locally , building and deploying it on aws codepipeline gives error 通过Visual Studio部署到AWS时出错 - Error deploying to AWS through visual studio 使用 Terraform 部署到多个 AWS 账户? - Deploying to multiple AWS accounts with Terraform? 在 AWS Secrets Manager awscli 中收到错误:通过 Terraform 部署时找不到版本“AWSCURRENT” - Receiving error in AWS Secrets manager awscli for: Version "AWSCURRENT" not found when deployed via Terraform 删除目标组时出错:通过 Terraform 更改 AWS 中的目标端口时 ResourceInUse - Error deleting Target Group: ResourceInUse when changing target ports in AWS through Terraform Github在Jenkins中部署到AWS beantalk时提交消息 - Github commit message when deploying to aws beanstalk in Jenkins 使用 aws s3 作为使用 terraform 的版本控制时出错 - Error using aws s3 as version control using terraform 在 AWS 上使用 Terraform 定义新策略,但版本出错 - Defining new policy with Terraform on AWS, but gets error in Version
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM