Multiple provider versions with Terraform

馋奶兔 提交于 2021-02-17 06:09:21

问题


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

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

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".

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

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


回答1:


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

Plugin Names and Versions

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



来源:https://stackoverflow.com/questions/61774501/multiple-provider-versions-with-terraform

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!