Terraform Provider Alias Issue

Hello!

Read through this similar issue, and still can’t figure out what I am doing wrong thus would appreciate feedback.

contents of provider.tf:

terraform {
  required_version = "1.0.4"
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "3.53.0"
    }
  }
}

provider "aws" {
  alias = "main"
  profile = var.main_account_profile
  region  = var.main_account_region
  shared_credentials_file = "${pathexpand("~/.aws/credentials")}"
}


provider "aws" {
  alias = "identities"
  profile = var.identities_account_profile
  region  = var.identities_account_region
  shared_credentials_file = "${pathexpand("~/.aws/credentials")}"
}

According to the information in the linked discussion and online doc, I don’t understand why running terraform init results in terraform looking for a provider “alias”?

Result of terraform init:

☹  terraform init                                                                ruby-2.6.3 development af0710f ✗

Initializing the backend...

Initializing provider plugins...
- Finding hashicorp/aws versions matching "3.53.0"...
- Finding latest version of hashicorp/alias...
- Installing hashicorp/aws v3.53.0...
- Installed hashicorp/aws v3.53.0 (signed by HashiCorp)
╷
│ Error: Failed to query available provider packages
│
│ Could not retrieve the list of available versions for provider hashicorp/alias: provider registry
│ registry.terraform.io does not have a provider named registry.terraform.io/hashicorp/alias
│
│ All modules should specify their required_providers so that external consumers will get the correct providers
│ when using a module. To see which modules are currently depending on hashicorp/alias, run the following
│ command:
│     terraform providers
╵

Solved!

Error was mine; I had provider = alias.main in 1 of my resources