具有 Terraform 的多个提供程序版本 [英] Multiple provider versions with Terraform

查看:28
本文介绍了具有 Terraform 的多个提供程序版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁知道是否可以有一个使用多个提供程序版本的 Terraform 脚本?

Does anyone know if it is possible to have a Terraform script that uses multiple provider versions?

例如 azurerm 2.0.0 版用于创建一个资源,而 1.4.0 版用于另一个?我尝试指定提供者,如此处所述:https://www.terraform.io/docs/configuration/providers.html

For example azurerm version 2.0.0 to create one resource, and 1.4.0 for another? I tried specifying the providers, as documented here: https://www.terraform.io/docs/configuration/providers.html

然而,它似乎不起作用,因为它试图解析同时满足 1.4.0 和 2.0.0 的单个提供程序.它的错误如下:

However it doesn't seem to work as it tries to resolve a single provider that fullfills both 1.4.0 and 2.0.0. It errors like:

No provider "azurerm" plugins meet the constraint "=1.4.0,=2.0.0".

我之所以这么问是因为我们有一个大型 Terraform 代码库,如果可行,我想逐位迁移.

I'm asking this because we have a large Terraform codebase and I would like to migrate bits by bits if doable.

曾经有人提出过类似的问题,这里:Terraform:如何安装多个版本的提供程序插件?但它没有得到有效的答案

There used to be a similar question raised, here: Terraform: How to install multiple versions of provider plugins? But it got no valid answer

推荐答案

不,你不能为所欲为.Terraform 期望您的约束与一个插件版本相匹配:

No you cannot do what you want. Terraform expects your constraint to match one plugin version as eluded to in:

如果安装了多个版本的插件,Terraform 将使用满足配置版本限制的最新版本.

If multiple versions of a plugin are installed, Terraform will use the newest version that meets the configuration's version constraints.

因此无法解析您的约束以匹配任何插件,因此出现错误

So your constraint cannot be parsed to match anyone plugin, hence the error

这篇关于具有 Terraform 的多个提供程序版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆