Multiple Versions of Same Provider + Explicit Module Provider

Hi guys,

We’re in a situation where we have to start using a module in our existing terraform which requires an older version of the AWS provider (2.70.0)

However everything else is using the latest AWS provider.

We have no control over the module and it doesn’t specify its own version constraint.

Essentially what we want to do is have the two different versions of the provider available and pass the older one into the new module and have everything else use the newer one.

What is the best way to achieve this?

Thanks

Hi @fferguson6,

Terraform’s model for providers is that the entire configuration must agree on a single version for each distinct provider. This is because, unlike most other concepts in Terraform, provider configurations can cross module boundaries and thus the module which defines the configuration must agree with all of the modules that are using the configuration as to which exact provider version they are using. (Internally, they are all sharing exactly the same provider object, which is configured only once.)

Unfortunately I think there isn’t a good answer to meet the requirements you’ve framed here. My only idea is that if you can’t influence that third-party module being updated for a newer Terraform version then you fork your own copy of it and make those updates yourself, so that it then agrees with the rest of your configuration as to which AWS provider version it will use.