Terraform init trying to install hashicorp/iam provider, which doesn't exist

I’m trying to init and my code as IAM roles, policies, and such. It’s trying to load the hashicorp/iam provider, which doesn’t exist. I have thousands of lines of code with roles and policies that work in other projects, but this new project won’t init.

The IAM provider is embedded within the AWS provider, is it not?

Is there something special with IAM that this code needs to be in modules or something to init?

$ terraform init -backend=false

Initializing provider plugins...
- Finding hashicorp/archive versions matching "~> 2.1"...
- Finding latest version of hashicorp/iam...
- Finding hashicorp/aws versions matching "~> 3.0"...
- Installing hashicorp/archive v2.2.0...
- Installed hashicorp/archive v2.2.0 (self-signed, key ID 34365D9472D7468F)
- Installing hashicorp/aws v3.50.0...
- Installed hashicorp/aws v3.50.0 (self-signed, key ID 34365D9472D7468F)

Partner and community providers are signed by their developers.
If you'd like to know more about provider signing, you can read about it here:

https://www.terraform.io/docs/cli/plugins/signing.html
Error: Failed to query available provider packages

Could not retrieve the list of available versions for provider hashicorp/iam:
provider registry registry.terraform.io does not have a provider named
registry.terraform.io/hashicorp/iam

If you have just upgraded directly from Terraform v0.12 to Terraform v0.14
then please upgrade to Terraform v0.13 first and follow the upgrade guide for
that release, which might help you address this problem.

Most likely, you’ve misidentified the type of one of your resources, and it begins with iam_ instead of aws_iam_, like writing iam_role when you meant aws_iam_role.

Terraform uses the first word of the resource name to infer the provider type; it knows that aws_iam_role is supplied by aws, but thinks that iam_role is supplied by a provider called iam, and the default install path for that would be registry.terraform.io/hashicorp/iam.

1 Like