@cdktn/provider-project

中文文档
0.9.17发布于 2026/11/02MPL-2.0TypeScriptCommonJS构建来源已验证近 30 天下载 3391

[!IMPORTANT] > > OCF - github.com/open-constructs has stepped up to fork under the new name of CDK Terrain - cdktn.io

原始使用文档
文档目录5 节
  1. Usage
  2. Creating a new provider
  3. Updating an existing Provider
  4. Deprecating old package versions
  5. Development

The Future of Terraform CDK

[!IMPORTANT]

OCF - github.com/open-constructs has stepped up to fork under the new name of CDK Terrain - cdktn.io


Terraform CDK Provider Project

A project template for projen to create repositories for prebuilt provider packages for CDK Terrain.

Usage

The provider repos are entirely auto generated from the configuration contained in this repo here. There's no manual interaction necessary, except for creating the initial repository - using this repo. The cdktn get command is executed as part of the build pipeline in Github Actions. These jobs are executed on a schedule. Hence, new provider changes will be picked up automatically.

Creating a new provider

[!NOTE] Only Offical Terraform Providers or Hashicorp partner Terraform Poviders will be accepted for pre-built provider generation.

Add a new repository over here.

In the newly created repository, all we need is a .projenrc.js file like this:

const { CdktnProviderProject } = require('@cdktn/provider-project');
const { Semver } = require('projen');

const project = new CdktnProviderProject({
  terraformProvider: "aws@~> 2.0"
});

project.synth();

Adjust the terraformProvider attribute as required and run the following commands:

npm install @cdktn/provider-project@latest
npx projen
pnpm install

This will generate an entire repository ready to be published, including Github Workflows for publishing NPM, Pypi and maven packages. The only thing which is needed to be set manually are the tokens for these registries:

  • NPM_TOKEN (only when npmTrustedPublishing is false; the cdktn-io provider repositories publish via OIDC and hold no npm token)
  • TWINE_PASSWORD / TWINE_USERNAME (only when pypiTrustedPublishing is false)
  • MAVEN_GPG_PRIVATE_KEY
  • MAVEN_GPG_PRIVATE_KEY_PASSPHRASE
  • MAVEN_PASSWORD
  • MAVEN_USERNAME

Updating an existing Provider

Commit and push the required changes to this repository here and wait for the auto-release to happen. Once released, you can run the following commands in the target provider repository:

npm install @cdktn/provider-project@latest
npx projen
pnpm install

Commit, push and check for the auto-released version.

Deprecating old package versions

Deprecating published versions is a manual, maintainer-driven step. The release workflow used to carry an automated deprecate job that ran npm deprecate after each release of a deprecated provider; it was removed because provider repositories no longer hold an NPM_TOKEN (npm publishing uses OIDC trusted publishing, which cannot authorize npm deprecate).

  • npm: a maintainer with publish rights on the package runs, locally:

    npm deprecate <pkg>@"<range>" "<message>"
    

    e.g. npm deprecate @cdktn/provider-random@"<12.0.0" "See https://cdktn.io/docs/concepts/providers#import-providers for how to generate the bindings locally.". An empty message ("") un-deprecates.

  • PyPI: there is no deprecation mechanism (pypi/warehouse#345). Leave published releases alone. Do not yank them, because pip then skips them for any requirement that isn't an exact == pin. The deprecation notice in the README (rendered on the PyPI project page) is the signal.

  • Go: still automated -- a provider marked isDeprecated gets a // Deprecated: comment prepended to its go.mod during the Go publish job.

  • Maven / NuGet: no automated path; NuGet supports deprecation only via the nuget.org web UI.

Development

Whatever needs to be changed in the downstream provider repositories should be done via the code definitions here.

For local development, pnpm link might be quite helpful for testing.

版本与发布记录

@cdktn/provider-project 共发布 39 个版本,首次发布于 2026/01/09;过去 12 个月发布了 39 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.9.17latest2026/11/027 天前
0.9.162026/10/2812 天前
0.9.152026/10/2812 天前
0.9.142026/10/081 个月前
0.9.132026/10/081 个月前
0.9.122026/10/071 个月前

关于 @cdktn/provider-project 的常见问题

@cdktn/provider-project 是什么?

[!IMPORTANT] > > OCF - github.com/open-constructs has stepped up to fork under the new name of CDK Terrain - cdktn.io

如何安装 @cdktn/provider-project?

在项目目录运行 npm install @cdktn/provider-project,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:projen(^0.101.20)、constructs(^10.5.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@cdktn/provider-project 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@cdktn/provider-project 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@cdktn/provider-project 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >= 22.11.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@cdktn/provider-project 可以商用吗?

@cdktn/provider-project 使用 MPL-2.0 许可。弱 Copyleft:可以商用,也可以和闭源代码一起使用;但如果分发时修改了 MPL 授权的文件,这些文件的修改需以 MPL 开源。以上为概括,不构成法律意见,请以许可原文为准。

@cdktn/provider-project 的下载量有多少?

根据 npm 官方下载统计,@cdktn/provider-project 在 2026/10/10 – 2026/11/08 这 30 天内被下载 3,391 次,日均约 113 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@cdktn/provider-project 还在维护吗?

最新版本 0.9.17 发布于 2026/11/02(7 天前);至今共发布 39 个版本,其中过去 12 个月发布了 39 个;首次发布于 2026/01/09。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。