Terraform upgrade from 0.12.26 to 0.13.2

I am in the process of upgrading terraform from 0.12.26 to 0.13.2
I have followed the terraform documentation Upgrading to Terraform v0.13 | Terraform by HashiCorp
i am seeing below error.

Error: missing provider provider["registry.terraform.io/hashicorp/aws"].region

This is my backend.tf

provider "aws" {
  alias  = "region"
  region = var.region
}

provider "aws" {
  alias  = "primary"
  region = var.region
}


terraform {
  backend "s3" {
    encrypt = true
  }
  required_version = "= 0.13.2"
  required_providers {
    aws = {
      source  = "*****/hashicorp/aws"
      version = "= 4.13.0"
    }
    null = {
      source  = "*****/hashicorp/null"
      version = "=3.1.1"
    }
    template = {
      source  = "*****/hashicorp/template"
      version = "=2.2.0"
    }
    
  }
}

data "aws_caller_identity" "current" {
  provider = aws.region
}

module "aurora" {
  providers = {
    aws = aws.region
  }
****
****
}

It is difficult to read the code you’ve pasted, as you’ve entered it in a way which various special characters get wrongly interpreted as formatting.

Please surround your code with lines containing three backticks (```) so that the discussion system knows to render it appropriately - otherwise it’s just too hard to read.

Hi @dreamsofravi51,

Have you tried Terraform v0.13.7, which is the latest v0.13 patch release at the time of writing? Later patch releases sometimes include fixes to the automatic upgrade functionality, so I’d suggest always using the latest patch release for the minor release you’re upgrading to when following the upgrade guides.

If you still see the same error when using v0.13.7, we can try to debug more to see what’s causing it. Thanks!

Not yet . will try to upgrade.