nf generate providers
Generate Python bindings for multiple providers in one command.
Synopsis
nf generate providers [PROVIDER_NAME ...] [OPTIONS]
Provider Selection
Choose one input mode:
- Positional names:
nf generate providers hashicorp/aws hashicorp/google- Provider set:
--set, -s- Config file:
--config, -c(YAML, JSON, or TOML)
Name providers by source address (namespace/name). When a version is resolved
from the registry, a bare name is looked up the way Terraform looks up an
unqualified name (/v1/providers/-/<name>/versions), which knows only
hashicorp's providers: aws is hashicorp/aws, while a name it does not know
(keycloak) or whose provider has moved (github, now integrations/github)
is an error asking for the source address.
Options
--output-dir TEXT: base output directory (default:providers).--version TEXT: default version for providers without explicit versions (default:latest).--binding-revision INTEGER: non-negative binding revision (default:0); applies to every selected provider.--parallel, -p: generate providers in parallel.--clean: clean existing packages before generation.--skip-formatting: skip formatting and linting after generation.--no-package: generate code files only (skip package scaffolding).--schema-loading [disk|memory]: schema loading strategy for each provider run.--max-workers N: threads generating each provider (default: up to 4;generation_max_workersin[tool.nf.config]).--verbose, -v: show detailed output.--yes, -y: skip confirmation prompts.--update-versions: update versions in config file to latest matching versions.--clear-cache: clear provider version cache (~/.cache/nf/provider-versions, ornf --provider-version-cache-dir) before resolving versions.
Package versions
The Python package version follows the resolved Terraform provider release. Revision 0
uses that release unchanged (6.71.0). To publish a binding fix for the same provider,
set --binding-revision 1 to produce 6.71.0.1, then increment that revision for each
subsequent binding release. This requires a three-component provider release and package
scaffolding (--no-package cannot be combined with a nonzero revision).
nf generate providers hashicorp/aws --version 6.71.0 --binding-revision 1 -y
The revision is explicit: regeneration never increments it automatically. Pass the same
revision on subsequent generations of that release, including with --clean. Start at
revision 0 again for a new provider release. uv version --bump patch increments the
upstream patch component; it does not increment the binding revision.
[tool.nf] records the original provider-version and binding-revision. Generated
provider classes continue to request the original Terraform binary version. Dependencies
use the Python package version: ==6.71.0 pins the original bindings, while ==6.71.0.*
allows binding revisions. Revision .0 would compare equal to the original release, so
positive revisions start at .1.
A provider build with its own label (<release>-<label>, which Python versions do not allow)
keeps it as a local version: with binding revision 1 it becomes <release>.1+<label>, while its
provider pin stays <release>-<label>. Local versions are for private indexes or local
installation; PyPI rejects them.
Generation Flow
For each selected provider:
- Resolve provider version.
- Resolve schema source:
- cached schema, or native provider schema, or Terraform CLI fallback.
- Generate provider package under:
<output-dir>/<org>/<provider>/
--schema-loading applies to Terraform CLI schema capture for every provider in the batch.
Schema Loading
generation_schema_loading in [tool.nf.config] can set the default schema-loading mode:
diskmemory
--schema-loading overrides it for the current command.
Config File Shape
defaults:
version: latest
providers:
- name: hashicorp/aws
version: "5.0.0"
- name: hashicorp/google
output_dir: /tmp/providers/google
Examples
# Generate two providers
nf generate providers hashicorp/aws hashicorp/google -y
# Generate common set in parallel with disk loading
nf generate providers --set common --parallel --schema-loading disk -y
# Generate from config
nf generate providers --config nf-providers.yaml --output-dir /tmp/providers -y