Skip to content
Error: Provider configuration not present

Error: Provider configuration not present

DodaTech 3 min read

Terraform’s “Provider configuration not present” error means a resource references a provider without a provider block, so Terraform cannot authenticate.

What It Means

Every Terraform resource belongs to a provider — AWS, Azure, Google Cloud, Kubernetes, etc. When you define a resource like aws_instance, Terraform expects an accompanying provider configuration. Without it, Terraform doesn’t know which region, credentials, or endpoint to use.

Why It Happens

  • The provider block is missing from your configuration files.
  • The required_providers block is not set in the terraform block.
  • You haven’t run terraform init to download the provider plugin.
  • The provider version constraint conflicts with the installed version.
  • The provider is specified in a module but not in the root configuration.
  • A typo in the provider source or name.

How to Fix It

Step 1: Add a required_providers block

Every modern Terraform configuration should declare providers explicitly:

terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 5.0"
    }
  }
}

Step 2: Define the provider block

Add at least one provider block with the required configuration:

provider "aws" {
  region = "us-east-1"
}

For Kubernetes:

provider "kubernetes" {
  config_path = "~/.kube/config"
}

Step 3: Run terraform init

After adding provider declarations, download the provider plugins:

terraform init

This installs the provider versions specified in your required_providers block.

Step 4: Check provider version constraints

If you see a version-related error, verify your constraint allows the installed version:

terraform providers

This lists all required providers and their versions. Adjust the version constraint if needed:

required_providers {
  aws = {
    source  = "hashicorp/aws"
    version = ">= 4.0, < 6.0"
  }
}

Step 5: Verify provider configuration for modules

If you’re using a module that requires a provider, it must be configured in the root module. Add a providers block in the module call if the module uses provider aliases:

module "vpc" {
  source    = "./modules/vpc"
  providers = {
    aws = aws
  }
}
What's the difference between required_providers and a provider block?
required_providers declares which provider plugins Terraform should download and their version constraints. The provider block configures the provider with credentials, region, and other settings. You need both — one declares the dependency, the other configures it.
Can I define multiple provider blocks for the same provider?
Yes, using provider aliases. Define one default provider and additional aliases for different regions or configurations: provider "aws" { region = "us-east-1" } and provider "aws" { alias = "west" region = "us-west-2" }. Then reference the alias in resources: provider = aws.west.
Why does terraform init not find my provider?
The provider source must be correct. Check terraform providers to see what Terraform expects. If the source is wrong (e.g. aws instead of hashicorp/aws), Terraform cannot locate it. Also verify your internet connection and that the registry is accessible.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro