升级 Terraform 代码从版本 0.13.5 到最新版本

huangapple go评论56阅读模式
英文:

Upgrading Terraform code from 0.13.5 to the latest version

问题

我继承了一个过时的Terraform代码库,它当前运行在0.13.5版本上,并继承了我猜想是专门为0.13.5编写的Terraform模块。

关于将代码库从0.13.5升级到最新版本(1.3.9)可能会出现的问题,我找不到太多信息。

在升级时,我是否需要更改导入的模块?

是不是更好先从0.13.5升级到0.14+,然后再升级到0.15+等等?

我是否需要更改AWS提供程序的版本?目前全局使用的是3.9.0版本。

请随时分享您的建议,关于最佳方法是什么。

英文:

I've inherited a Terraform code base that is outdated. It's currently running on 0.13.5 and inherits Terraform modules that I guess were written specifically for 0.13.5.

There is not that much info I can find regarding on what the complications could be when upgrading the code base from 0.13.5 to the latest (1.3.9).

Would I need to change anything in the modules that get pulled in?

Would it better to upgrade from 0.13.5 to 0.14+ then on to 0.15+ etc?

Would I need to change the version of the AWS Provider? That is currently 3.9.0 across the board.

Please feel free to share your suggestions on what the best approach would be.

答案1

得分: 1

根据文档

如果您当前使用的是Terraform v0.13或更早版本,我们强烈建议您一次升级一个主要版本,直到达到Terraform v0.14,按照每个版本的升级指南进行升级,因为较早的版本包括自动检测配置所需更改的机制,并在某些情况下还会自动编辑配置以包括这些更改。一旦达到Terraform v0.14,您就可以直接从那里跳到Terraform v1.0。

还请注意以下内容:

如果您愿意,您也可以直接从Terraform v0.14升级,尽管请仍然考虑Terraform v0.15升级指南中的说明。如果您受到该升级指南中的说明的影响,仍需要按照那里描述的步骤进行操作,但可以作为升级到v1.0的一部分来完成,无需中间步骤运行Terraform v0.15。

要从0.13升级到0.14,您可以参考此指南

提供程序版本应该是良好的,只要您没有太多使用S3存储桶的资源,因此在升级之前,请务必阅读升级指南

英文:

As per the documentation:

> If you are currently using Terraform v0.13 or earlier then we strongly recommend upgrading one major version at a time until you reach Terraform v0.14, following the upgrade guides of each of those versions, because those earlier versions include mechanisms to automatically detect necessary changes to your configuration, and in some cases also automatically edit your configuration to include those changes. Once you reach Terraform v0.14 you can then skip directly from there to Terraform v1.0.

Note the following as well:

> You can also upgrade directly from Terraform v0.14 if you wish, although please still consider the notes from the Terraform v0.15 upgrade guide. If you are affected by the notes in that upgrade guide, you will still need to take the steps described there but you can do so as part of upgrading to v1.0, without any need for an intermediate step of running Terraform v0.15.

For upgrading from 0.13 to 0.14, you can follow this guide.

The provider version should be good as long as you do not have too many resources which are using S3 buckets, so prior to upgrading make sure to read the upgrade guide.

huangapple
  • 本文由 发表于 2023年3月7日 22:07:12
  • 转载请务必保留本文链接:https://go.coder-hub.com/75663028.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定