website: provider version constraints in modules

This commit is contained in:
Martin Atkins 2019-10-28 15:36:16 -07:00
parent ddd0d2a442
commit 7c110f9cf8
1 changed files with 20 additions and 1 deletions

View File

@ -200,6 +200,25 @@ provider configuration must be destroyed before that provider configuration is
removed, unless the related resources are re-configured to use a different removed, unless the related resources are re-configured to use a different
provider configuration first. provider configuration first.
### Provider Version Constraints in Modules
To declare that a module requires particular versions of a specific provider,
use the [`required_providers`](/docs/configuration/terraform.html#specifying-required-provider-versions)
setting inside a `terraform` block:
```hcl
terraform {
required_providers {
aws = ">= 2.7.0"
}
}
```
Shared modules should constrain only the minimum allowed version, using a `>=`
constraint. This specifies the minimum version the provider is compatible
with while allowing users to upgrade to newer provider versions without
altering the module source code.
### Implicit Provider Inheritance ### Implicit Provider Inheritance
For convenience in simple configurations, a child module automatically inherits For convenience in simple configurations, a child module automatically inherits
@ -238,7 +257,7 @@ or a child module may need to use different provider settings than
its parent. For such situations, it's necessary to pass providers explicitly its parent. For such situations, it's necessary to pass providers explicitly
as we will see in the next section. as we will see in the next section.
## Passing Providers Explicitly ### Passing Providers Explicitly
When child modules each need a different configuration of a particular When child modules each need a different configuration of a particular
provider, or where the child module requires a different provider configuration provider, or where the child module requires a different provider configuration