OpenTofu Error: 'Invalid resource type' provider does not support the type
Fix OpenTofu's 'Invalid resource type' error: add the missing provider to required_providers, run tofu init, and correct typos or wrong-provider resource names.
- #opentofu
- #terraform
- #iac
- #troubleshooting
- #errors
Stuck on this OpenTofu error? Get the free incident triage checklist
A one-page PDF — the exact steps to isolate, fix, and verify a production error like this one. No spam, unsubscribe anytime.
Exact Error Message
╷
│ Error: Invalid resource type
│
│ on main.tf line 12, in resource "aws_s3_buckett" "assets":
│ 12: resource "aws_s3_buckett" "assets" {
│
│ The provider hashicorp/aws does not support resource type "aws_s3_buckett".
╵
A closely related variant appears when the provider itself is not declared:
│ Error: Invalid resource type
│
│ The provider registry.opentofu.org/hashicorp/aws was not found in the
│ required_providers list for this module.
What It Means
Every resource block’s type prefix (the part before the first underscore group, like aws_, google_, random_) tells OpenTofu which provider owns it. During tofu validate and tofu plan, OpenTofu asks the resolved provider whether it defines that exact resource type. If the provider has no such type, or if no provider is required for that prefix at all, you get Invalid resource type.
There are two distinct root causes hiding behind one message: either the type name is wrong (a typo, a renamed resource, or a resource that belongs to a different provider), or the correct provider was never declared and installed so OpenTofu has nothing to ask.
Common Causes
- A typo in the resource type (
aws_s3_buckettinstead ofaws_s3_bucket). - Using a resource that belongs to a different provider than the one installed (e.g.
azurerm_resource with onlyawsconfigured). - The provider is not listed in
required_providers, so OpenTofu never installed it. - You added a new provider’s resource but did not re-run
tofu initto install it. - The resource was renamed or removed in a newer major version of the provider.
- A custom or community provider is not correctly sourced, so its types are unknown.
Diagnostic Commands
Validate the configuration to pinpoint the offending block and line:
tofu validate
List which providers OpenTofu currently has installed and required:
tofu providers
Confirm the lock file and installed versions after init:
tofu version
Search the codebase for the exact type you used to catch typos:
grep -rn "aws_s3_buckett" .
Step-by-Step Resolution
-
Read the error’s provider line. If it says the provider “does not support resource type”, the type name is wrong. If it says the provider “was not found in the required_providers list”, the provider is missing.
-
For a wrong type name, correct the spelling or use the right resource. Verify the exact type against the provider documentation, then fix the block:
resource "aws_s3_bucket" "assets" {
bucket = "my-app-assets"
}
- For a missing provider, declare it in
required_providersand configure it:
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.0"
}
}
}
provider "aws" {
region = "us-east-1"
}
- Install the provider so OpenTofu learns its resource types:
tofu init
Initializing provider plugins...
- Installing hashicorp/aws v5.60.0...
OpenTofu has been successfully initialized!
-
If the resource was renamed in a provider upgrade, consult the provider’s upgrade guide for the new type name and adjust, then re-run validate.
-
Re-validate and plan to confirm the type now resolves:
tofu validate && tofu plan
Prevention
- Pin provider versions in
required_providersand read upgrade guides before bumping a major version that may rename or remove resources. - Run
tofu initwhenever you add a resource from a provider you have not used yet in that module. - Use editor tooling or
tofu validatein pre-commit to catch typos and unknown types before they reach CI. - Keep each provider’s resources under the correct provider block; do not mix cloud-specific types without declaring every provider.
- Reference the official provider registry documentation for exact resource type names rather than guessing.
Related Errors
Failed to install provider— the provider is declared but could not be downloaded during init.Invalid provider configuration— the provider resolves but its configuration is wrong.Reference to undeclared resource— you referenced a resource address that no block defines.Unsupported argument— the type is valid but an argument inside it is not.
Frequently Asked Questions
Is ‘Invalid resource type’ always a typo? No. It has two causes: a wrong or renamed type name, or a provider that was never declared and installed. Read the provider line in the error to tell which one you have.
I fixed required_providers but still get the error — why? You likely have not re-run tofu init. OpenTofu only learns a provider’s resource types after the provider is installed, so init is required after adding one.
How do I find the correct resource type name? Check the provider’s registry documentation and run tofu providers to confirm which providers are actually available in your module.
A resource that worked before now errors after an upgrade — what happened? The provider probably renamed or removed that type in a new major version. Consult the provider’s upgrade guide for the replacement and update your configuration.
Can I get help correcting provider blocks quickly? Yes — the prompt library at /prompts/?stack=opentofu includes prompts that scaffold required_providers and fix mismatched types. For more IaC fixes, browse the OpenTofu guides.
Fixed it? Get 500 OpenTofu & DevOps AI prompts — free
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.
Did this fix your issue?
Get 500 Battle-Tested DevOps AI Prompts — Free
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.