Introduction
A module in Terraform is a logical, reusable grouping of resources. Terraform modules can be classified into two major categories - root modules and child modules. This article provides a range of possible scenarios of failures or known issues that may occur when using Terraform modules. For more information around Terraform modules, refer to the modules documentation.
Scenarios
Error: Provider configuration not present
When declaring child modules in Terraform configuration, your child modules may inherit provider configurations from its parent module via either implicitly or explicitly.
There are two options for passing explicit providers into child module.
1. Child module with alias providers
When using the provider alias in a child module, the parent module with the module block declaration that references to the child module is required to have the providers meta-argument in order to pass the aliased provider explicitly from the parent module. This sample error Error: Provider configuration not present
from the output below demonstrates the missing providers meta-argument
for the provider alias mpxashdns01
.
Terraform v0.12.20
Configuring remote state backend...
Initializing Terraform configuration...
2020/04/14 21:01:09 [DEBUG] Using modified User-Agent: Terraform/0.12.20 TFE/v202003-1
Error: Provider configuration not present
To work with module.deploy-vip-v1.infoblox_record_host.host its original
provider configuration at module.deploy-vip-v1.provider.infoblox.mpxashdns01
is required, but it has been removed. This occurs when a provider
configuration is removed while objects created by that provider still exist in
the state. Re-add the provider configuration to destroy
module.deploy-vip-v1.infoblox_record_host.host, after which you can remove the
provider configuration again.
The multiple provider configuration documentation provides you an example of how to declare an aliased provider and the alternate provider configurations documentation guides you on how to pass an aliased provider into a Terraform module.
2. Child module with default providers
A child module may declare a provider without aliasing or furthermore the provider declaration can be completely omitted as this configuration is optional where it follows the default behavior of the providers inheritance. In this scenario, a parent module is able to pass an alternate provider to a child module explicitly by following the guide in the Selecting Alternate Provider Configurations document
Additional information
If you continue to experience the issues after following the guides, please contact HashiCorp Support to request for further assistance.