Skip to content
Latchkey

Terraform "timeout while waiting for state to become" in CI

Many resources poll until they reach a target state (available, running, ACTIVE). When that does not happen within the configured timeout, the provider gives up and apply fails.

What this error means

terraform apply errors with "timeout while waiting for state to become [available]" (or similar), naming the resource and the state it never reached.

terraform
Error: timeout while waiting for state to become 'available'
(last state: 'pending', timeout: 10m0s)

  with aws_db_instance.main,
  on rds.tf line 3, in resource "aws_db_instance" "main":

Common causes

Operation genuinely slow

Some resources (RDS, large clusters) take longer than the default timeout under load.

Resource stuck in an intermediate state

A misconfiguration or upstream issue leaves the resource pending; it will never reach the target state.

Transient cloud API or runner network blip

A dropped poll or a brief API outage interrupts the wait.

How to fix it

Raise the resource timeout

Increase the create/update timeout for resources that are legitimately slow.

Terraform
resource "aws_db_instance" "main" {
  # ...
  timeouts {
    create = "40m"
    update = "40m"
  }
}

Investigate a genuinely stuck resource

  1. Check the cloud console for the resource's real status and events.
  2. If it is stuck on a config error, fix the config and re-apply.
  3. If it is just slow, re-run apply so Terraform resumes the wait.

How to prevent it

  • Set realistic timeouts blocks for slow resource types.
  • Provision slow resources in a separate, less time-pressured pipeline stage.
  • Monitor cloud-side quotas and capacity that can stall creates.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →