How to fix Error: Error running plan: 1 error occurred in Terraform

TerraformBEGINNERMEDIUMUpdated Dec 30, 2025ยท 138 views

Terraform plan failed with a generic error message indicating one or more problems with your configuration. This error requires looking at the detailed error message that follows to identify the actual issue, which could be syntax errors, invalid resource configurations, or provider problems.

Quick fix

Fixes Error: Error running plan: 1 error occurred

Error: Error running plan: 1 error occurred:
* resource.aws_instance.example: invalid or unsupported argument "ami_id"
  on main.tf line 5, in resource "aws_instance" "example":
  5:   ami_id = "ami-0c55b159cbfafe1f0"
  1. Read the full error message carefully
  2. Validate your Terraform configuration
  3. Check for typos in resource type and attribute names
  4. Verify variable and resource references
terraform โ€” error
Error: Error running plan: 1 error occurred:
* resource.aws_instance.example: invalid or unsupported argument "ami_id"
on main.tf line 5, in resource "aws_instance" "example":
5: ami_id = "ami-0c55b159cbfafe1f0"
Error: Error running plan: 1 error occurred

What this error means

The "Error running plan" message is a generic wrapper that Terraform displays when the plan operation encounters any configuration or provider error. Unlike more specific error messages, this one indicates that Terraform's core plan engine encountered one or more validation failures. The actual error details will follow this message and are crucial for diagnosis. The error could originate from HCL syntax problems, invalid resource arguments, missing required fields, provider initialization failures, or authentication issues.

Typical symptoms

  • terraform plan command fails immediately without showing detailed error
  • Error message shows 'Error running plan: 1 error occurred' but details are cut off or unclear
  • The specific error details appear after the generic message (read the full output carefully)
  • terraform apply fails with the same error, preventing any changes
  • The error occurs during the planning phase, not during resource creation

Common causes

  1. HCL syntax error in your Terraform configuration files (.tf files)
  2. Missing or invalid required argument in a resource or data source block
  3. Invalid attribute name or unsupported argument for the resource type
  4. Invalid reference to an undeclared variable, output, or resource
  5. Provider configuration missing or misconfigured (auth, region, endpoint, etc.)
  6. Incompatible provider version for the resource type you're using
  7. Invalid type or value for a variable (e.g., string where number is required)
  8. Circular dependency in your resource definitions

How to fix "Error: Error running plan: 1 error occurred"

1Read the full error message carefully

The generic error message is just the wrapper. The actual problem details appear right after it. Look for:

1. Line numbers: Check the .tf file and line number mentioned
2. Attribute name: What specific configuration is wrong
3. Error type: Syntax error, invalid reference, missing argument, etc.

Example full error:

bash
Error: Error running plan: 1 error occurred:
* resource.aws_instance.example: invalid or unsupported argument "ami_id"
  on main.tf line 5, in resource "aws_instance" "example":
  5:   ami_id = "ami-0c55b159cbfafe1f0"

The actual error here is "invalid or unsupported argument" - the attribute is called ami, not ami_id.

2Validate your Terraform configuration

Run terraform validate to catch syntax and structural errors:

bash
terraform validate

This will show all validation errors without requiring provider credentials or remote state access. It's faster than plan and helps isolate configuration problems:

- If validate passes but plan fails: Check your provider configuration
- If validate fails: Fix the errors it reports before proceeding

3Check for typos in resource type and attribute names

Verify you're using the correct:

1. Resource type: Check the Terraform Registry for the exact type name

hcl
resource "aws_instance" "example" {
   # Correct resource type
   # NOT: resource "aws_ec2_instance"

2. Attribute names: Use Terraform Registry documentation to verify spelling

bash
ami           = "ami-0c55b159cbfafe1f0"  # Correct
   # NOT: ami_id or image_id (depends on provider)

Visit https://registry.terraform.io to find the exact resource type and argument names for your provider.

4Verify variable and resource references

Check that all references are valid and declared:

hcl
variable "instance_type" {
  type    = string
  default = "t3.micro"
}

resource "aws_instance" "example" {
  ami           = "ami-0c55b159cbfafe1f0"
  instance_type = "t3.micro"
}

Common mistakes:
- Using old Terraform 0.11 syntax with dollar signs
- Referencing a variable_name that doesn't exist
- Referencing a resource with a name that doesn't exist

5Check provider configuration and credentials

Ensure your provider is properly configured:

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

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

Verify:
1. Provider source and version are correct
2. Authentication is configured (environment variables, credentials file, or IAM role)
3. All required provider arguments are present

Set debug logging for more details:

bash
export TF_LOG=DEBUG
terraform plan
unset TF_LOG
6Use terraform fmt to fix formatting issues

Formatting errors can cause parse failures:

bash
terraform fmt -recursive

This reformats all .tf files in canonical format, fixing:
- Indentation errors
- Missing/extra spaces around operators
- Inconsistent block structure

Then run validate again:

bash
terraform validate

Advanced notes

Understanding Terraform error messages:

Terraform's error output provides structured information:
- Error category describes what went wrong
- Filename and line number point to the problem
- The problematic line is shown for context

Always read past the generic error to the specific details. The real cause is in the detailed message.

Common error categories:

1. "invalid or unsupported argument": Check the Registry for correct attribute name
2. "missing required argument": Add the required field to your configuration
3. "Invalid type or value": Ensure the value matches the expected type (string, number, bool, etc.)
4. "Unsupported block type": The block type doesn't exist in this resource/data source
5. "Invalid reference": The referenced resource/variable/output doesn't exist or is misspelled

Debugging strategies:

- Isolate: Comment out blocks and re-run validate incrementally
- Compare: Check official documentation examples for correct syntax
- Test: Use simple, minimal configurations to isolate the issue
- Logs: Set TF_LOG=DEBUG for verbose provider output

Frequently asked questions

What does "Error: Error running plan: 1 error occurred" mean?
The "Error running plan" message is a generic wrapper that Terraform displays when the plan operation encounters any configuration or provider error. Unlike more specific error messages, this one indicates that Terraform's core plan engine encountered one or more validation failures. The actual error details will follow this message and are crucial for diagnosis.
How do I fix "Error: Error running plan: 1 error occurred"?
Terraform plan failed with a generic error message indicating one or more problems with your configuration. This error requires looking at the detailed error message that follows to identify the actual issue, which could be syntax errors, invalid resource configurations, or provider problems.
What causes "Error: Error running plan: 1 error occurred"?
HCL syntax error in your Terraform configuration files (.tf files) Missing or invalid required argument in a resource or data source block Invalid attribute name or unsupported argument for the resource type
Is the "Error: Error running plan: 1 error occurred" error serious?
It is a medium-severity error โ€” more of a blocker than a risk. The steps above resolve it.

Official resources & further reading