-
Notifications
You must be signed in to change notification settings - Fork 9.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Separate provider version constraints from provider configuration #16835
Comments
That terraform block will be placed in the module right? Is it currently possible to have two providers of the same type (one with an alias) but different versions? If so, would this change work with that? |
It is not currently possible to have two providers with different versions in the same configuration, and this new approach does not change that. Instead, Terraform would continue its current behavior: find the newest available plugin that meets all of the given constraints. If two modules (or today, two |
If a provider's version does not meet any one module's constraints for that provider as defined in its |
It does indeed get detected by
|
Does the Do you think it would make sense to have some functionality as part of the providers command that could adjust the provider versions for you? Or perhaps just output a provider version such that it fits within the constraints of all modules which define a version provider. If no such version exists, that could be said as well, which would signal that your modules are wholly incompatible. |
Yes, there were not any child modules in my example configuration there but the purpose of that providers command is to show you all of the distinct version constraints across all
|
Would this alleviate the need to explicitly pass modules to satisfy version constraints? Taking the example in #16824 (comment), would the module instance become (removals commented):
Basically, when a module in the new system declares |
Hi @dghubble, That's exactly the idea. The proposal allows modules to separate the provider version constraints from the provider configuration. There can only be one version of a provider at a time, so provider version constraints are applied globally. The proposed |
Proposal sounds good to me then :) |
Hi Guys, When can we expect to see that feature to "Allow Variable to control provider version" ?? Thanks |
Is this still being considered? |
It is likely (though not confirmed) that this will be in the initial 0.12 release. Since it's a stretch goal, it may end up being deferred to a later 0.12 point release, but we definitely to still plan to do it. |
Thanks @apparentlymart |
@apparentlymart thanks for this, im hitting an issue on a submodule which had What about modules that have multiple providers with aliases? Is the recommendation now to not have multiple providers on a single module? |
@neerfri There is a whole series of blog posts on upcoming 0.12 changes, in case you haven't seen them: https://www.hashicorp.com/blog/category/terraform |
Hi all! The feature I described in this issue has now been merged into master ready to be included in the forthcoming v0.12.0 release. I just verified it in the v0.12.0-alpha1 build by using the configuration example in my original comment.
Terraform v0.12.0 will now treat this new form as an alternative way to set provider version constraints. The old form with the constraint inside the Since this is merged and ready for release, I'm going to close out this issue. Thanks for the great discussion here! |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
When we introduced provider version constraints in 0.10 it felt natural to do this via a new
version
argument inside the existingprovider
block type, like this:However, in 0.11 we changed the model for how providers and modules interact to address some confusing interactions such as inheritance of aliased configurations, partial overriding, and instantiating the same module source multiple times with different provider configurations. This new model has caused us to recommend that
provider
blocks should appear only in a root module, and re-usable modules (which are analogous to libraries in a traditional programming language) should instead receive provider configurations as an argument, either implicitly (through inheritance) or explicitly (via the newproviders
argument for modules).Due to the prior overloading of the
provider
block to represent both a single provider configuration and a constraint on the (global) provider version, this has effectively left reusable modules no convenient way to declare provider version constraints.To rectify this, we're considering introducing a new provider version constraints mechanism within the
terraform
block, alongside the existingrequired_version
attribute that constraints the version of Terraform Core:By separating the idea of a provider version constraint from the idea of a provider configuration we can resolve the architectural wart that 0.11's new approach introduced.
Given that the
version
argument for theprovider
block has been around for some time now we would retain it as an alternative way to make constraints, but the new approach described above would become the recommended method for specifying constraints in child modules.Some further recommendations would be required due to the fact that each provider can only have a single version at a time for a given configuration:
>=
constraint for the minimum version that contains the features it requires, unless there is a known incompatibility with a later version.~>
constraints to lock to a particular major or minor version (depending on the user's risk tolerance) that is at least as new as the newest minimum from a child module.The text was updated successfully, but these errors were encountered: