"Missing required argument" while updating provider configurations for v0.13

I’m having trouble getting terraform to recognize region value/argument following upgrade to 0.13.0-rc1.

Pretty simple setup, one module created, with dependencies on aws and template provider. Upgrade process detected existing providers and created the necessary requred_provider section with references to “hashicorp/aws” and “hashicorp/template”, which were then
manually renamed to “registry.terraform.io/-/aws” and “registry.terraform.io/-/template” to reflect definitions in the existing state.

Subsequent plans now error out.

$ terraform plan -out update.plan
Error: Missing required argument
The argument "region" is required, but was not set.

I suspect with the new changes, the region values defined in the provider are now ignored. Or possibly the region AND profile section, as when setting local AWS_DEFAULT_REGION=“us-west-2”, error changes to security token included in the request is invalid (which makes me thing profile value is now ignored).

-- versions.tf --
terraform {
  required_providers {
    aws = {
#      source = "hashicorp/aws"
      source = "registry.terraform.io/-/aws"
      version = "2.70.0"
    template = {
#      source = "hashicorp/template"
      source = "registry.terraform.io/-/template"
      version = "2.1.2"
  required_version = ">= 0.13"

-- data.tf --
provider "aws" {
  profile = "prod"
  region = "us-west-2"
  version = "2.70.0"

provider "template" {
  version = "2.1.2"

Hi @joenuts1!

I split this off from the v0.13.0 beta program topic because nobody was monitoring that topic anymore and so I didn’t see this until today. Sorry about that.

I hope you found an answer some other way in the meantime, but in case not (and in case someone with a similar problem finds this topic) I’ll answer it.

Those -/aws and -/template providers are placeholders representing un-qualified provider references in your existing state which Terraform is tracking so that it can (usually) auto-migrate them during the next terraform apply. So with that said, it’s not expected to use those legacy addresses in your configuration: instead, you should use the new name hashicorp/aws or hashicorp/template, which terraform apply should then use as the fully-qualified provider to migrate to.

Another option, if you want to be explicit about it, is to directly migrate those existing references in the state. This will still create a new state snapshot, like terraform apply would, but it won’t change anything except the provider references in the state:

terraform state replace-provider 'registry.terraform.io/-/aws' 'registry.terraform.io/hashicorp/aws'
terraform state replace-provider 'registry.terraform.io/-/template' 'registry.terraform.io/hashicorp/template'

The intended final state is that you have no “legacy” provider references at all, because both your configuration and your state will refer to the fully-qualified ones.

The way this failed for you is interesting and different than how others have experienced it, but I think it still has the a similar root cause: something else in your configuration probably caused Terraform to determine that you also need hashicorp/aws, but there’s no configuration block for that provider in your configuration and so validation for it failed. Once everything is consistently using hashicorp/aws that problem should, I think, go away.