This error occurs when you define overrides for resources that don't exist in your base Terraform configuration. Override files are meant to modify existing resources, not create new ones. This validation error prevents invalid configurations from being applied.
Fixes Error: Override values provided for resource without matching configuration
# Example _override.tf file that causes the error
resource "aws_instance" "web_server" {
instance_type = "t2.large" # Override value
}
# This would fail if aws_instance.web_server doesn't exist in base config# Example _override.tf file that causes the errorresource "aws_instance" "web_server" {instance_type = "t2.large" # Override value}# This would fail if aws_instance.web_server doesn't exist in base configError: Override values provided for resource without matching configuration
Terraform has special handling for override files (ending in _override.tf or _override.tf.json) that allow you to selectively override portions of your configuration. However, these overrides must reference resources that already exist in your base configuration files. When Terraform detects an override block for a resource address that doesn't have a matching resource definition in your regular configuration files, it raises this error. The override system is designed to merge with existing blocks, not to define new resources from scratch.
Open your override file (_override.tf or override.tf) and note the exact resource address being overridden. The error message should tell you which resource is problematic.
# Example _override.tf file that causes the error
resource "aws_instance" "web_server" {
instance_type = "t2.large" # Override value
}
# This would fail if aws_instance.web_server doesn't exist in base configDocument the resource type and name exactly as it appears in the override block.
Search your base configuration files (.tf files excluding override files) to verify the resource is actually defined. Use grep to find the resource:
# Search for the resource in base config (non-override files)
grep -r "resource \"aws_instance\" \"web_server\"" . --include="*.tf" | grep -v override
# Or search more broadly
grep -r "aws_instance" . --include="*.tf" | grep -v overrideThe resource must exist in a file that does NOT end in _override.tf or override.tf.
If the resource doesn't exist in your base config, add it. The override file cannot create resources—it can only modify existing ones. Create the base resource definition first:
# main.tf - Add the missing resource
resource "aws_instance" "web_server" {
ami = "ami-12345678"
instance_type = "t2.micro" # Base value
tags = {
Name = "web-server"
}
}
# _override.tf - Now you can override it
resource "aws_instance" "web_server" {
instance_type = "t2.large" # Override replaces this
}The base resource must include at minimum the required arguments for the resource type.
Ensure the resource type and name in the override block exactly match the base configuration. Terraform resource addresses are case-sensitive and must be precise:
# INCORRECT - Names don't match
# main.tf
resource "aws_instance" "web_server" { ... }
# _override.tf (WRONG)
resource "aws_instance" "webserver" { ... } # Missing underscore
# CORRECT - Exact match
# main.tf
resource "aws_instance" "web_server" { ... }
# _override.tf (RIGHT)
resource "aws_instance" "web_server" { ... } # Exact matchDouble-check for typos, missing underscores, or differences in capitalization between the two blocks.
If a resource no longer exists in your configuration and you no longer need the override, remove the override block entirely:
# _override.tf - DELETE EVERYTHING IN THIS BLOCK
resource "aws_instance" "old_server" {
instance_type = "t2.small"
}
# If you don't need this override anymore, remove it completelyIf the override file becomes empty, you can delete the file entirely. Terraform will warn if you have only override files and no base configuration.
After making corrections, validate your configuration and run a plan to confirm the error is resolved:
# Validate syntax and semantics
terraform validate
# Run plan to ensure no errors
terraform planThe plan output should show no override-related errors. Review the changes Terraform intends to make to verify they match your expectations.
Override files are most useful in specific scenarios like Terraform Cloud/Enterprise where programmatically-generated JSON overrides need to coexist with human-edited HCL configuration. However, for most use cases, it's cleaner to use variables and conditional logic instead of override files.
If you're encountering this error frequently, consider whether you're using override files correctly. A resource definition should never exist ONLY in an override file—it violates Terraform's design principle that override files merge with (not replace) base configuration.
When working in teams, make sure all team members understand override file naming conventions and keep override changes well-documented, as they can make configuration harder to understand.