From 7c110f9cf8fafe1733b43c098db0c78dd11967fa Mon Sep 17 00:00:00 2001 From: Martin Atkins Date: Mon, 28 Oct 2019 15:36:16 -0700 Subject: [PATCH] website: provider version constraints in modules --- website/docs/configuration/modules.html.md | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/website/docs/configuration/modules.html.md b/website/docs/configuration/modules.html.md index 969e17573..48232ecc4 100644 --- a/website/docs/configuration/modules.html.md +++ b/website/docs/configuration/modules.html.md @@ -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 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 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 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 provider, or where the child module requires a different provider configuration