OpenTofu "Invalid provider registry host" in CI
A provider source address in your configuration names a registry host that OpenTofu could not use, either because the host does not implement the provider registry protocol or the address is malformed after migration.
What this error means
tofu init fails with "Error: Invalid provider registry host" naming the source address, for example "the host \"registry.terraform.io\" given in provider source address ... does not offer a OpenTofu provider registry".
Error: Invalid provider registry host
The host "terraform.example.com" given in provider source address
"terraform.example.com/hashicorp/aws" does not offer a OpenTofu provider
registry that is compatible with this OpenTofu version.Common causes
A source address points at a non-registry host
The source names a hostname that does not serve the provider registry discovery protocol, so tofu cannot resolve providers from it.
A leftover Terraform-registry source after migration
A hardcoded registry.terraform.io/... source may not resolve the same way under OpenTofu; prefer the default namespace or the OpenTofu registry host.
How to fix it
Use the default source or a valid registry host
- Drop the explicit host and use the short
namespace/nameform so tofu uses its default registry. - If you must name a host, ensure it serves the OpenTofu provider registry protocol.
- Re-run
tofu initto confirm the source resolves.
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.0"
}
}
}Configure a provider mirror instead of a raw host
To serve providers internally, set up a filesystem or network mirror and point tofu at it via CLI config rather than a bare source host.
provider_installation {
network_mirror {
url = "https://tofu-mirror.example.com/providers/"
}
}How to prevent it
- Prefer short
namespace/nameprovider sources over hardcoded hosts. - Use a proper provider mirror for internal distribution.
- Recheck provider sources when migrating from Terraform.