Problem Description
Sometimes , We get failure
Failed to query available provider packages
Could not retrieve the list of available versions for provider hashicorp/*****: provider registry
registry.terraform.io does not have a provider named registry.terraform.io/hashicorp/*****
Did you intend to use *****/****? If so, you must specify that source address in each module which requires hat provider. To see which modules are currently depending on hashicorp/******, run the following command:
terraform providers
Possible Causes
This error sometimes comes when the internal modules are not having providers definition blocks , Hence as per the suggestion in error, we should run the `terraform provider` command and see which module is having providers defined in their .tf files .
Sample output of "terraform providers" :-
Possible Solutions :-
In the output of `terraform providers` you can see that various modules are looking for their own ****/******/provider separately , to resolve- as per documentation -
You need to declare required providers under both module's main.tf as below, and after that it should start initializing fine .
terraform {
required_providers {
provider1= {
source = "****/*****/**"
version = "1.42.0"
}
}
}
.........
.......
...