This error occurs when Terraform times out waiting for a resource (especially AWS routes) to reach its desired state. The operation exceeds the timeout threshold, often due to misconfigured timeouts, network issues, or provider bugs.
When Terraform provisions or updates resources, it polls the cloud provider API to verify the resource has reached its desired state. This error means Terraform waited longer than the configured timeout period (default 2-10 minutes depending on resource type) without the resource completing the operation. The timeout can be explicitly configured in your Terraform code, but if the resource is slower than expected or the timeout configuration is ignored by the provider, you see this error.
Add or modify the timeouts block on the resource to allow more time for provisioning:
resource "aws_route" "example" {
route_table_id = aws_route_table.example.id
destination_cidr_block = "0.0.0.0/0"
gateway_id = aws_internet_gateway.example.id
timeouts {
create = "5m"
update = "5m"
delete = "5m"
}
}For other AWS resources, adjust the timeouts block accordingly. Some resources support different timeout operations (create, update, delete).
Log into your AWS Management Console (or applicable cloud provider) and verify the resource is actually being created despite the timeout:
1. Navigate to the relevant service (EC2, Route Tables, RDS, etc.)
2. Search for the resource by name or ID
3. Check the resource state (running, available, pending, etc.)
4. If the resource exists and is in the desired state, the issue is just a timeout waiting, not a failed creation
5. If the resource is stuck in a "pending" or intermediate state, investigate cloud provider logs
If the resource exists, you can import it into your Terraform state to continue: terraform import <resource-type>.<name> <resource-id>
Ensure Terraform can reach the cloud provider API:
1. Check if your internet connection is stable
2. Verify firewall and security group rules allow outbound HTTPS (port 443) access
3. Check if the cloud provider is experiencing an outage (check their status page)
4. If using a proxy, ensure it's properly configured in your Terraform environment
5. Run terraform plan to verify provider authentication is working correctly
Network latency can compound and cause operations to exceed timeout limits.
For AWS, configure retry behavior at the provider level:
provider "aws" {
region = "us-east-1"
retry_mode = "standard"
max_retries = 25
}The standard retry mode uses exponential backoff for transient errors. The max_retries setting controls how many times failed API calls are retried before giving up.
Simplify your infrastructure design to reduce provisioning time:
1. Break large deployments into smaller modules
2. Remove unnecessary resource dependencies
3. Use parallel resource creation by removing depends_on relationships where possible
4. Create resources in stages rather than all at once
5. For large databases or instances, pre-allocate sufficient capacity
Large or complex deployments can take longer due to cascading operations. Running terraform apply -parallelism=5 can help multiple resources provision simultaneously.
This error was a known bug in older AWS provider versions. Update to the latest version:
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.0" # Use latest stable version
}
}Then run:
terraform init -upgrade
terraform applyHigher provider versions include fixes for timeout handling and better state polling logic.
The timeout issue is particularly common with aws_route resources in older AWS provider versions (pre-v5.0), where the provider was not properly respecting configured timeout values and would default to 2 minutes regardless of settings. This was a known bug that was fixed in later versions. If you're using timeouts but they're still being ignored, check your provider version first. For aws_route specifically, routes can take 10-15 seconds to become "ready", but network conditions can extend this. Setting timeouts to at least 5 minutes is recommended for production deployments. Additionally, some resources like RDS instances can legitimately take 30+ minutes to provision, so account for this in your timeout configuration.
Error: Error rendering template: template not found
How to fix "template not found" error in Terraform
Error: Error generating private key
How to fix 'Error generating private key' in Terraform
Error creating Kubernetes Service: field is immutable
How to fix "field is immutable" errors in Terraform
Error: Error creating local file: open: permission denied
How to fix "Error creating local file: permission denied" in Terraform
Error: line endings have changed from CRLF to LF
Line endings have changed from CRLF to LF in Terraform