.iac files to TypeScript, Python, or Go, it generates a package.json, requirements.txt, or go.mod alongside the Pulumi program. Without provider version constraints, these generated dependency files use the latest available version — which changes over time, breaks reproducibility, and can introduce provider bugs silently when someone runs ubx apply weeks after the last successful apply. The provider block pins the version of a Pulumi provider in your .iac source. This version constraint is propagated into the generated dependency file for whatever runtime you’re using, ensuring every environment and every apply uses the same provider version unless you explicitly update it.
What you’ll learn
- How
providerblocks pin Pulumi provider versions in generated dependency files - The version constraint syntax (NPM semver)
- How
ubx schema syncuses the pinned version to cache the correct schema
Why this matters
Provider version pinning is the difference between reproducible infrastructure and infrastructure that silently starts failing when a provider releases a breaking change. Pin your providers in
.iac source the same way you pin library versions in application code — it’s not optional in production.The source code
How it works
The provider block is read during code generation
When ubx generates the runtime project (TypeScript, Python, or Go), it reads every
provider block and translates the version constraint into the appropriate dependency format for the target runtime.The version constraint is written to the dependency file
For TypeScript:
"@pulumi/aws": "~6.0.0" in package.json. For Python: pulumi-aws~=6.0 in requirements.txt. For Go: the specific module version in go.mod. The constraint format is adapted to each ecosystem’s syntax.ubx schema sync uses the pinned version
When you run
ubx schema sync aws, ubx downloads the schema for the pinned version (~> 6.0 resolves to the latest 6.x release). The schema cache is version-aware — running ubx validate after changing the version constraint will trigger a re-sync if the new version’s schema isn’t cached.What ubx generates
Common mistakes
Run it
What you learned
provider blocks pin Pulumi provider versions in generated package.json, requirements.txt, or go.modVersion constraints use NPM semver syntax regardless of the target runtime
ubx schema sync uses the pinned version to cache the correct provider schemaNext steps
Third-party provider (Datadog)
Use a non-AWS provider with dynamic schema sync
provider block reference
Full provider block syntax
Full runnable example: github.com/ubiquex/ubx-examples/37-provider-version-pinning

