Skip to content
Latchkey

Terraform "no available releases match" provider constraint in CI

init resolves a single provider version that satisfies every constraint from the root and all modules. When those constraints conflict or no published version fits, no solution exists.

What this error means

init fails with "no available releases match the given constraints" for a provider. It surfaces when modules pin incompatible ranges, or a constraint excludes every published version.

terraform
Error: Failed to query available provider packages

Could not retrieve the list of available versions for provider hashicorp/aws:
no available releases match the given constraints >= 5.0.0, < 4.67.0

Common causes

Conflicting constraints across modules

The root and a module (or two modules) pin ranges that do not overlap, so no single version satisfies all of them.

Constraint excludes all releases

A typo or an impossible range (e.g. >= 5.0.0, < 4.67.0) leaves no published version to choose.

How to fix it

Reconcile the version constraints

Align the root and module constraints to an overlapping, satisfiable range.

versions.tf
terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = ">= 5.40.0, < 6.0.0"   # overlaps every module's range
    }
  }
}

Diagnose which constraint conflicts

  1. Run init with TF_LOG=debug to see each constraint and its source.
  2. Loosen or correct the range that excludes all versions.
  3. Re-run init to confirm a single version resolves.

How to prevent it

  • Keep root and module provider constraints compatible.
  • Avoid impossible ranges; double-check upper/lower bounds.
  • Upgrade modules to versions with current constraints.

Related guides

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