diff --git a/API.md b/API.md index a4b70187..c00c25a0 100644 --- a/API.md +++ b/API.md @@ -1670,8 +1670,10 @@ const cdktfProviderProjectOptions: CdktfProviderProjectOptions = { ... } | constructsVersion | string | *No description.* | | terraformProvider | string | *No description.* | | creationYear | number | The year of the creation of the repository, for copyright purposes. | +| deprecationDate | string | An optional date when the project should be considered deprecated, to be used in the README text. | | forceMajorVersion | number | *No description.* | | githubNamespace | string | defaults to "cdktf" previously was "hashicorp". | +| isDeprecated | boolean | Whether or not this prebuilt provider is deprecated. | | mavenEndpoint | string | *No description.* | | mavenOrg | string | defaults to "hashicorp". | | namespace | string | defaults to "cdktf". | @@ -3936,6 +3938,20 @@ Will fall back to the current year if not specified. --- +##### `deprecationDate`Optional + +```typescript +public readonly deprecationDate: string; +``` + +- *Type:* string + +An optional date when the project should be considered deprecated, to be used in the README text. + +If no date is provided, then the date of the build will be used by default. + +--- + ##### `forceMajorVersion`Optional ```typescript @@ -3960,6 +3976,20 @@ Used for GitHub org name and package scoping --- +##### `isDeprecated`Optional + +```typescript +public readonly isDeprecated: boolean; +``` + +- *Type:* boolean + +Whether or not this prebuilt provider is deprecated. + +If true, no new versions will be published. + +--- + ##### `mavenEndpoint`Optional ```typescript diff --git a/src/cdktf-config.ts b/src/cdktf-config.ts index 95a74ea2..884d1f10 100644 --- a/src/cdktf-config.ts +++ b/src/cdktf-config.ts @@ -20,14 +20,30 @@ interface CdktfConfigOptions { constructsVersion: string; packageInfo: PackageInfo; githubNamespace: string; + /** + * Whether or not this prebuilt provider is deprecated. + * If true, no new versions will be published. + */ + isDeprecated: boolean; + /** + * An optional date when the project should be considered deprecated, + * to be used in the README text. If no date is provided, then the + * date of the build will be used by default. + */ + deprecationDate?: string; jsiiVersion?: string; typescriptVersion?: string; } export class CdktfConfig { constructor(project: cdk.JsiiProject, options: CdktfConfigOptions) { - const { terraformProvider, providerName, jsiiVersion, typescriptVersion } = - options; + const { + terraformProvider, + providerName, + jsiiVersion, + typescriptVersion, + isDeprecated, + } = options; const cdktfVersion = options.cdktfVersion; const constructsVersion = options.constructsVersion; @@ -134,6 +150,7 @@ export class CdktfConfig { project.addFields({ cdktf: { + isDeprecated, provider: { name: fullyQualifiedProviderName, version: actualProviderVersion, diff --git a/src/deprecate-packages.ts b/src/deprecate-packages.ts new file mode 100644 index 00000000..639905d1 --- /dev/null +++ b/src/deprecate-packages.ts @@ -0,0 +1,91 @@ +/** + * Copyright (c) HashiCorp, Inc. + * SPDX-License-Identifier: MPL-2.0 + */ + +import { JsiiProject } from "projen/lib/cdk"; +import { JobPermission, JobStep } from "projen/lib/github/workflows-model"; +import { PackageInfo } from "./package-info"; + +export interface DeprecatePackagesOptions { + providerName: string; + packageInfo: PackageInfo; + isDeprecated: boolean; +} + +export class DeprecatePackages { + constructor(project: JsiiProject, options: DeprecatePackagesOptions) { + const { providerName, packageInfo, isDeprecated } = options; + + const deprecationMessageForNPM = [ + `See https://cdk.tf/imports for details on how to continue to use the ${providerName} provider`, + `in your CDK for Terraform (CDKTF) projects by generating the bindings locally.`, + ].join(" "); + // @see https://github.com/golang/go/issues/40357 + const deprecationMessageForGo = [ + `// Deprecated: HashiCorp is no longer publishing new versions of the prebuilt provider for ${providerName}.`, + `// Previously-published versions of this prebuilt provider will still continue to be available as installable Go modules,`, + `// but these will not be compatible with newer versions of CDK for Terraform and are not eligible for commercial support.`, + `// You can continue to use the ${providerName} provider in your CDK for Terraform projects with newer versions of CDKTF,`, + `// but you will need to generate the bindings locally. See https://cdk.tf/imports for details.`, + ].join("\n"); + + const deprecationStep: JobStep = { + name: "Mark the Go module as deprecated", + run: `find '.repo/dist/go' -mindepth 2 -maxdepth 4 -type f -name 'go.mod' | xargs sed -i '1s|^|${deprecationMessageForGo} \n|'`, + continueOnError: true, // @TODO remove this once we confirm it to be working + }; + if (isDeprecated) { + packageInfo.publishToGo?.prePublishSteps?.splice(-1, 0, deprecationStep); + } + + const releaseWorkflow = project.github?.tryFindWorkflow("release"); + if (!releaseWorkflow) { + throw new Error("Could not find release workflow, aborting"); + } + + releaseWorkflow.addJobs({ + deprecate: { + name: "Deprecate the package in package managers if needed", + runsOn: ["ubuntu-latest"], + needs: ["release", "release_npm"], + steps: [ + { + name: "Checkout", + uses: "actions/checkout@v4", + }, + { + name: "Install", + run: "yarn install", + }, + { + name: "Check deprecation status", + id: "check_status", + run: [ + `IS_DEPRECATED=$(npm pkg get cdktf.isDeprecated | tr -d '"')`, + `echo "is_deprecated=$IS_DEPRECATED"`, // for easier debugging + `echo "is_deprecated=$IS_DEPRECATED" >> $GITHUB_OUTPUT`, + ].join("\n"), + }, + { + name: "Deprecate the package on NPM", + if: "steps.check_status.outputs.is_deprecated", + run: `npm deprecate ${packageInfo.npm.name} "${deprecationMessageForNPM}"`, + env: { + NPM_REGISTRY: project.package.npmRegistry, + NPM_TOKEN: + "${{ secrets." + `${project.package.npmTokenSecret} }}`, + }, + }, + // Unfortunately, PyPi has no mechanism to mark a package as deprecated: https://github.com/pypi/warehouse/issues/345 + // Maven also never moved past the proposal stage: https://github.com/p4em/artifact-deprecation + // NuGet supports deprecation, but only via the web UI: https://learn.microsoft.com/en-us/nuget/nuget-org/deprecate-packages + // Go deprecation is handled in the "Publish to Go" step (see line 37) + ], + permissions: { + contents: JobPermission.READ, + }, + }, + }); + } +} diff --git a/src/index.ts b/src/index.ts index 3e995ce1..5c080ee4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -11,6 +11,7 @@ import { Automerge } from "./automerge"; import { CdktfConfig } from "./cdktf-config"; import { CopyrightHeaders } from "./copyright-headers"; import { CustomizedLicense } from "./customized-license"; +import { DeprecatePackages } from "./deprecate-packages"; import { ForceRelease } from "./force-release"; import { GithubIssues } from "./github-issues"; import { LockIssues } from "./lock-issues"; @@ -51,6 +52,16 @@ export interface CdktfProviderProjectOptions extends cdk.JsiiProjectOptions { * Will fall back to the current year if not specified. */ readonly creationYear?: number; + /** + * Whether or not this prebuilt provider is deprecated. + * If true, no new versions will be published. + */ + readonly isDeprecated?: boolean; + /** + * An optional date when the project should be considered deprecated, to be used in the README text. + * If no date is provided, then the date of the build will be used by default. + */ + readonly deprecationDate?: string; } const authorAddress = "https://hashicorp.com"; @@ -90,6 +101,8 @@ export class CdktfProviderProject extends cdk.JsiiProject { minNodeVersion, jsiiVersion, typescriptVersion, + isDeprecated, + deprecationDate, authorName = "HashiCorp", namespace = "cdktf", githubNamespace = "cdktf", @@ -97,6 +110,7 @@ export class CdktfProviderProject extends cdk.JsiiProject { nugetOrg = "HashiCorp", mavenOrg = "hashicorp", } = options; + const [fqproviderName, providerVersion] = terraformProvider.split("@"); const providerName = fqproviderName.split("/").pop(); assert(providerName, `${terraformProvider} doesn't seem to be valid`); @@ -183,7 +197,8 @@ export class CdktfProviderProject extends cdk.JsiiProject { // @see https://stackoverflow.com/a/49511949 "sed -i -e '/## Available Packages/,/### Go/!b' -e '/### Go/!d;p; s/### Go/## Go Package/' -e 'd' .repo/dist/go/*/README.md", // sed -e is black magic and for whatever reason the string replace doesn't work so let's try it again: - "sed -i 's/### Go/## Go Package/' .repo/dist/go/*/README.md", + // eslint-disable-next-line prettier/prettier + `sed -i 's/### Go/## ${isDeprecated ? 'Deprecated' : 'Go'} Package/' .repo/dist/go/*/README.md`, // Just straight up delete these full lines and everything in between them: "sed -i -e '/API.typescript.md/,/You can also visit a hosted version/!b' -e 'd' .repo/dist/go/*/README.md", `sed -i 's|Find auto-generated docs for this provider here:|Find auto-generated docs for this provider [here](https://${repositoryUrl}/blob/main/docs/API.go.md).|' .repo/dist/go/*/README.md`, @@ -225,7 +240,6 @@ export class CdktfProviderProject extends cdk.JsiiProject { devDeps: [ "@actions/core@^1.1.0", "dot-prop@^5.2.0", - "semver@^7.5.3", // used by src/scripts/check-for-upgrades.ts ...(options.devDeps ?? []), ], name: packageInfo.npm.name, @@ -238,6 +252,7 @@ export class CdktfProviderProject extends cdk.JsiiProject { repository: `https://github.com/${repository}.git`, mergify: false, eslint: false, + depsUpgrade: !isDeprecated, depsUpgradeOptions: { workflowOptions: { labels: ["automerge", "auto-approve", "dependencies"], @@ -308,9 +323,12 @@ export class CdktfProviderProject extends cdk.JsiiProject { 0, setSafeDirectory ); - const { upgrade, pr } = (this.upgradeWorkflow as any).workflows[0].jobs; - upgrade.steps.splice(1, 0, setSafeDirectory); - pr.steps.splice(1, 0, setSafeDirectory); + + if (!isDeprecated) { + const { upgrade, pr } = (this.upgradeWorkflow as any).workflows[0].jobs; + upgrade.steps.splice(1, 0, setSafeDirectory); + pr.steps.splice(1, 0, setSafeDirectory); + } // Fix maven issue (https://github.com/cdklabs/publib/pull/777) github.GitHub.of(this)?.tryFindWorkflow("release")?.file?.patch( @@ -334,15 +352,8 @@ export class CdktfProviderProject extends cdk.JsiiProject { typescriptVersion, packageInfo, githubNamespace, - }); - const upgradeScript = new CheckForUpgradesScriptFile(this, { - providerVersion, - fqproviderName, - }); - new ProviderUpgrade(this, { - checkForUpgradesScriptPath: upgradeScript.path, - workflowRunsOn, - nodeHeapSize: maxOldSpaceSize, + deprecationDate, + isDeprecated: !!isDeprecated, }); new CustomizedLicense(this, options.creationYear); new GithubIssues(this, { providerName }); @@ -350,14 +361,26 @@ export class CdktfProviderProject extends cdk.JsiiProject { new AutoCloseCommunityIssues(this, { providerName }); new Automerge(this); new LockIssues(this); - new AlertOpenPrs(this, { - slackWebhookUrl: "${{ secrets.ALERT_PRS_SLACK_WEBHOOK_URL }}", - repository, - }); - new ForceRelease(this, { - workflowRunsOn, - repositoryUrl, - }); + + if (!isDeprecated) { + const upgradeScript = new CheckForUpgradesScriptFile(this, { + providerVersion, + fqproviderName, + }); + new ProviderUpgrade(this, { + checkForUpgradesScriptPath: upgradeScript.path, + workflowRunsOn, + nodeHeapSize: maxOldSpaceSize, + }); + new AlertOpenPrs(this, { + slackWebhookUrl: "${{ secrets.ALERT_PRS_SLACK_WEBHOOK_URL }}", + repository, + }); + new ForceRelease(this, { + workflowRunsOn, + repositoryUrl, + }); + } new TextFile(this, ".github/CODEOWNERS", { lines: [ @@ -369,31 +392,34 @@ export class CdktfProviderProject extends cdk.JsiiProject { ], }); - new ShouldReleaseScriptFile(this, {}); + if (!isDeprecated) { + new ShouldReleaseScriptFile(this, {}); - const releaseTask = this.tasks.tryFind("release")!; - this.removeTask("release"); - this.addTask("release", { - description: releaseTask.description, - steps: releaseTask.steps, - env: (releaseTask as any)._env, - condition: "node ./scripts/should-release.js", - }); + const releaseTask = this.tasks.tryFind("release")!; + this.removeTask("release"); + this.addTask("release", { + description: releaseTask.description, + steps: releaseTask.steps, + env: (releaseTask as any)._env, + condition: "node ./scripts/should-release.js", + }); - const releaseJobSteps: any[] = ( - this.github?.tryFindWorkflow("release") as any - ).jobs.release.steps; - const gitRemoteJob = releaseJobSteps.find((it) => it.id === "git_remote"); - assert( - gitRemoteJob.run === - 'echo "latest_commit=$(git ls-remote origin -h ${{ github.ref }} | cut -f1)" >> $GITHUB_OUTPUT', - "git_remote step in release workflow did not match expected string, please check if the workaround still works!" - ); - const previousCommand = gitRemoteJob.run; - const cancelCommand = - 'echo "latest_commit=release_cancelled" >> $GITHUB_OUTPUT'; // this cancels the release via a non-matching SHA; - gitRemoteJob.run = `node ./scripts/should-release.js && ${previousCommand} || ${cancelCommand}`; - gitRemoteJob.name += " or cancel via faking a SHA if release was cancelled"; + const releaseJobSteps: any[] = ( + this.github?.tryFindWorkflow("release") as any + ).jobs.release.steps; + const gitRemoteJob = releaseJobSteps.find((it) => it.id === "git_remote"); + assert( + gitRemoteJob.run === + 'echo "latest_commit=$(git ls-remote origin -h ${{ github.ref }} | cut -f1)" >> $GITHUB_OUTPUT', + "git_remote step in release workflow did not match expected string, please check if the workaround still works!" + ); + const previousCommand = gitRemoteJob.run; + const cancelCommand = + 'echo "latest_commit=release_cancelled" >> $GITHUB_OUTPUT'; // this cancels the release via a non-matching SHA; + gitRemoteJob.run = `node ./scripts/should-release.js && ${previousCommand} || ${cancelCommand}`; + gitRemoteJob.name += + " or cancel via faking a SHA if release was cancelled"; + } // Submodule documentation generation this.gitignore.exclude("API.md"); // ignore the old file, we now generate it in the docs folder @@ -454,6 +480,11 @@ export class CdktfProviderProject extends cdk.JsiiProject { }); new CopyrightHeaders(this); + new DeprecatePackages(this, { + providerName, + packageInfo, + isDeprecated: !!isDeprecated, + }); } private pinGithubActionVersions(pinnedVersions: Record) { diff --git a/src/readme.ts b/src/readme.ts index 270962f5..2939f89f 100644 --- a/src/readme.ts +++ b/src/readme.ts @@ -12,6 +12,9 @@ export interface ReadmeFileOptions extends FileBaseOptions { providerVersion: string; packageInfo: PackageInfo; underlyingTerraformVersion: string; + cdktfVersion: string; + isDeprecated: boolean; + deprecationDate?: string; } export class ReadmeFile extends FileBase { @@ -29,6 +32,8 @@ export class ReadmeFile extends FileBase { providerVersion, packageInfo, underlyingTerraformVersion, + isDeprecated, + deprecationDate, } = resolver.resolve(this.options) as ReadmeFileOptions; const fqpnURL = fqproviderName.includes("/") @@ -37,21 +42,44 @@ export class ReadmeFile extends FileBase { const versionURL = providerVersion ? providerVersion.replace(/~>\s*/, "").concat(".0") : ""; + const registryUrl = `https://registry.terraform.io/providers/${fqpnURL}/${ + underlyingTerraformVersion !== "" + ? underlyingTerraformVersion + : versionURL + }`; + const cdktfVersion = this.options.cdktfVersion.replace("^", ""); + + const date = + deprecationDate ?? + new Date().toLocaleDateString("en-US", { + year: "numeric", + month: "long", + day: "numeric", + }); + const deprecationMessage = ` +HashiCorp made the decision to stop publishing new versions of prebuilt [Terraform ${providerName} provider](${registryUrl}) bindings for [CDK for Terraform](https://cdk.tf) on ${date}. As such, this repository has been archived and is no longer supported in any way by HashiCorp. Previously-published versions of this prebuilt provider will still continue to be available on their respective package managers (e.g. npm, PyPi, Maven, NuGet), but these will not be compatible with new releases of \`cdktf\` past \`${cdktfVersion}\` and are no longer eligible for commercial support. - return ` +As a reminder, you can continue to use the \`${fqpnURL}\` provider in your CDK for Terraform (CDKTF) projects, even with newer versions of CDKTF, but you will need to generate the bindings locally. The easiest way to do so is to use the [\`provider add\` command](https://developer.hashicorp.com/terraform/cdktf/cli-reference/commands#provider-add), optionally with the \`--force-local\` flag enabled: + + cdktf provider add ${fqpnURL} --force-local + +For more information and additional examples, check out our documentation on [generating provider bindings manually](https://cdk.tf/imports). + `.trim(); + + const readme = ` # CDKTF prebuilt bindings for ${fqpnURL} provider version ${ underlyingTerraformVersion !== "" ? `${underlyingTerraformVersion}` : `${providerVersion}` } -This repo builds and publishes the [Terraform ${providerName} provider](https://registry.terraform.io/providers/${fqpnURL}/${ - underlyingTerraformVersion !== "" - ? underlyingTerraformVersion - : versionURL - }/docs) bindings for [CDK for Terraform](https://cdk.tf). +${ + isDeprecated + ? deprecationMessage + : `This repo builds and publishes the [Terraform ${providerName} provider](${registryUrl}/docs) bindings for [CDK for Terraform](https://cdk.tf).` +} -## Available Packages +## ${isDeprecated ? "Deprecated" : "Available"} Packages ### NPM @@ -95,7 +123,6 @@ The Maven package is available at [https://mvnrepository.com/artifact/${ \`\`\` - ### Go The go package is generated into the [\`${ @@ -117,7 +144,12 @@ Find auto-generated docs for this provider here: - [Go](./docs/API.go.md) You can also visit a hosted version of the documentation on [constructs.dev](https://constructs.dev/packages/@cdktf/provider-${providerName}). +`; + return isDeprecated + ? readme + : readme + + ` ## Versioning This project is explicitly not tracking the Terraform ${providerName} provider version 1:1. In fact, it always tracks \`latest\` of \`${providerVersion}\` with every release. If there are scenarios where you explicitly have to pin your provider version, you can do so by [generating the provider constructs manually](https://cdk.tf/imports). @@ -125,11 +157,7 @@ This project is explicitly not tracking the Terraform ${providerName} provider v These are the upstream dependencies: - [CDK for Terraform](https://cdk.tf) -- [Terraform ${providerName} provider](https://registry.terraform.io/providers/${fqpnURL}/${ - underlyingTerraformVersion !== "" - ? underlyingTerraformVersion - : versionURL - }) +- [Terraform ${providerName} provider](${registryUrl}) - [Terraform Engine](https://terraform.io) If there are breaking changes (backward incompatible) in any of the above, the major version of this project will be bumped. diff --git a/src/scripts/check-for-upgrades.ts b/src/scripts/check-for-upgrades.ts index 98e78dc0..d418aaeb 100644 --- a/src/scripts/check-for-upgrades.ts +++ b/src/scripts/check-for-upgrades.ts @@ -20,6 +20,8 @@ export class CheckForUpgradesScriptFile extends FileBase { ) { super(project, "scripts/check-for-upgrades.js", options); this.options = options; + + project.addDevDeps("semver@^7.5.3"); } protected synthesizeContent(resolver: IResolver): string | undefined { diff --git a/test/__snapshots__/index.test.ts.snap b/test/__snapshots__/index.test.ts.snap index d0101b41..f14303c6 100644 --- a/test/__snapshots__/index.test.ts.snap +++ b/test/__snapshots__/index.test.ts.snap @@ -1,5 +1,2062 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`has a custom workflow and README if the project is deprecated 1`] = ` +{ + ".copywrite.hcl": "schema_version = 1 + +project { + license = "MPL-2.0" + copyright_year = 2021 + + # (OPTIONAL) A list of globs that should not have copyright/license headers. + # Supports doublestar glob patterns for more flexibility in defining which + # files or folders should be ignored + header_ignore = [ + "**/node_modules/**", + "lib/**", + "dist/**", + "logs/**", + "build/**", + ".gen/**", + ".github/ISSUE_TEMPLATE/**", + ".terraform/**", + "docs/**", + "API.md", + ".mergify.yml", + "scripts/*.js" + ] +} +", + ".gitattributes": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +/.copywrite.hcl linguist-generated +/.gitattributes linguist-generated +/.github/CODEOWNERS linguist-generated +/.github/ISSUE_TEMPLATE/config.yml linguist-generated +/.github/pull_request_template.md linguist-generated +/.github/workflows/auto-approve.yml linguist-generated +/.github/workflows/auto-close-community-issues.yml linguist-generated +/.github/workflows/auto-close-community-prs.yml linguist-generated +/.github/workflows/automerge.yml linguist-generated +/.github/workflows/build.yml linguist-generated +/.github/workflows/lock.yml linguist-generated +/.github/workflows/pull-request-lint.yml linguist-generated +/.github/workflows/release.yml linguist-generated +/.github/workflows/stale.yml linguist-generated +/.gitignore linguist-generated +/.npmignore linguist-generated +/.projen/** linguist-generated +/.projen/deps.json linguist-generated +/.projen/files.json linguist-generated +/.projen/tasks.json linguist-generated +/cdktf.json linguist-generated +/docs/*.md linguist-generated +/LICENSE linguist-generated +/package.json linguist-generated +/README.md linguist-generated +/tsconfig.dev.json linguist-generated +/yarn.lock linguist-generated", + ".github/CODEOWNERS": "# These owners will be the default owners for everything in +# the repo. Unless a later match takes precedence, +# they will be requested for review when someone opens a +# pull request. +* @cdktf/tf-cdk-team", + ".github/ISSUE_TEMPLATE/config.yml": "blank_issues_enabled: false +contact_links: + - name: File an issue + url: "https://github.com/hashicorp/terraform-cdk/issues/new?labels=bug%2C+new%2C+pre-built+providers&template=bug-report-prebuilt-providers.md&title=\`random\`+provider:+" + about: Please file issues with pre-built providers in our main repository. +", + ".github/pull_request_template.md": "Fixes #", + ".github/workflows/auto-approve.yml": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +name: auto-approve +on: + pull_request_target: + types: + - opened + - labeled + - ready_for_review + - reopened +concurrency: \${{ github.workflow }}-\${{ github.head_ref }} +jobs: + approve: + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write + if: contains(github.event.pull_request.labels.*.name, 'auto-approve') && github.event.pull_request.draft == false + steps: + - name: Checkout PR + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + with: + ref: \${{ github.event.pull_request.head.ref }} + repository: \${{ github.event.pull_request.head.repo.full_name }} + - name: Auto-approve PRs by other users as team-tf-cdk + if: github.event.pull_request.user.login != 'team-tf-cdk' && (contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.pull_request.author_association) || github.actor == 'dependabot[bot]') + env: + GH_TOKEN: \${{ secrets.PROJEN_GITHUB_TOKEN }} + run: gh pr review \${{ github.event.pull_request.number }} --approve + - name: Auto-approve PRs by team-tf-cdk as github-actions[bot] + if: github.event.pull_request.user.login == 'team-tf-cdk' + env: + GH_TOKEN: \${{ secrets.GITHUB_TOKEN }} + run: gh pr review \${{ github.event.pull_request.number }} --approve +", + ".github/workflows/auto-close-community-issues.yml": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +name: auto-close-community-issues +on: + issues: + types: + - opened +jobs: + autoclose: + runs-on: ubuntu-latest + permissions: + issues: write + if: github.event.issue.user.login != 'team-tf-cdk' && !contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR", "CONTRIBUTOR"]'), github.event.issue.author_association) + steps: + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + - name: Auto-close issues by non-collaborators + env: + GH_TOKEN: \${{ secrets.GITHUB_TOKEN }} + run: gh issue close \${{ github.event.issue.number }} --reason "not planned" --comment "Hi there! 👋 We appreciate your interest, but this is probably not the right place. All the code in this repository is auto-generated using [cdktf-provider-project](https://github.com/cdktf/cdktf-provider-project) and [cdktf-repository-manager](https://github.com/cdktf/cdktf-repository-manager) from the source [Terraform provider](https://github.com/terraform-providers/terraform-provider-random). If there are problems, they should be addressed in one of those 3 repositories, not here, as any changes here will just get overwritten the next time there is an update upstream. Please open a new issue or PR in one of those repos. In the meantime, I'll auto-close this. Thanks!" + - name: Add labels + env: + GH_TOKEN: \${{ secrets.GITHUB_TOKEN }} + run: gh issue edit \${{ github.event.issue.number }} --add-label "invalid,wontfix" +", + ".github/workflows/auto-close-community-prs.yml": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +name: auto-close-community-prs +on: + pull_request: + types: + - opened +jobs: + autoclose: + runs-on: ubuntu-latest + permissions: + pull-requests: write + if: github.event.pull_request.user.login != 'team-tf-cdk' && !contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR", "CONTRIBUTOR"]'), github.event.pull_request.author_association) + steps: + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + - name: Auto-close PRs by non-collaborators + env: + GH_TOKEN: \${{ secrets.GITHUB_TOKEN }} + run: gh pr close \${{ github.event.pull_request.number }} --comment "Hi there! 👋 We appreciate your interest, but this is probably not the right place. All the code in this repository is auto-generated using [cdktf-provider-project](https://github.com/cdktf/cdktf-provider-project) and [cdktf-repository-manager](https://github.com/cdktf/cdktf-repository-manager) from the source [Terraform provider](https://github.com/terraform-providers/terraform-provider-random). If there are problems, they should be addressed in one of those 3 repositories, not here, as any changes here will just get overwritten the next time there is an update upstream. Please open a new issue or PR in one of those repos. In the meantime, I'll auto-close this. Thanks!" + - name: Add labels + env: + GH_TOKEN: \${{ secrets.GITHUB_TOKEN }} + run: gh pr edit \${{ github.event.pull_request.number }} --add-label "invalid,wontfix" +", + ".github/workflows/automerge.yml": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +name: automerge +on: + pull_request_target: + types: + - opened + - labeled + - ready_for_review + - reopened + - synchronize +concurrency: \${{ github.workflow }}-\${{ github.head_ref }} +jobs: + automerge: + runs-on: ubuntu-latest + permissions: + contents: read + if: contains(github.event.pull_request.labels.*.name, 'automerge') && !contains(github.event.pull_request.labels.*.name, 'do-not-merge') && github.event.pull_request.draft == false + steps: + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + - name: Turn on automerge for this PR by a trusted user or bot + if: github.event.pull_request.user.login == 'team-tf-cdk' || contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.pull_request.author_association) || github.actor == 'dependabot[bot]' + env: + GH_TOKEN: \${{ secrets.PROJEN_GITHUB_TOKEN }} + run: gh pr merge --auto --squash \${{ github.event.pull_request.number }} +", + ".github/workflows/build.yml": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +name: build +on: + pull_request: {} + workflow_dispatch: {} +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: write + outputs: + self_mutation_happened: \${{ steps.self_mutation.outputs.self_mutation_happened }} + env: + CI: "true" + steps: + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + with: + ref: \${{ github.event.pull_request.head.ref }} + repository: \${{ github.event.pull_request.head.repo.full_name }} + fetch-depth: 0 + - name: Install dependencies + run: yarn install --check-files + - name: Set git config safe.directory + run: git config --global --add safe.directory $(pwd) + - name: build + run: npx projen build + - name: Revert package.json version bump + run: git checkout package.json + - name: Setup Copywrite tool + uses: hashicorp/setup-copywrite@867a1a2a064a0626db322392806428f7dc59cb3e + - name: Add headers using Copywrite tool + run: copywrite headers + - name: Find mutations + id: self_mutation + run: |- + git add . + git diff --staged --patch --exit-code > .repo.patch || echo "self_mutation_happened=true" >> $GITHUB_OUTPUT + - name: Upload patch + if: steps.self_mutation.outputs.self_mutation_happened + uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 + with: + name: .repo.patch + path: .repo.patch + - name: Fail build on mutation + if: steps.self_mutation.outputs.self_mutation_happened + run: |- + echo "::error::Files were changed during build (see build log). If this was triggered from a fork, you will need to update your branch." + cat .repo.patch + exit 1 + - name: Backup artifact permissions + run: cd dist && getfacl -R . > permissions-backup.acl + continue-on-error: true + - name: Upload artifact + uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 + with: + name: build-artifact + path: dist + self-mutation: + needs: build + runs-on: ubuntu-latest + permissions: + contents: write + if: always() && needs.build.outputs.self_mutation_happened && !(github.event.pull_request.head.repo.full_name != github.repository) + steps: + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + with: + token: \${{ secrets.PROJEN_GITHUB_TOKEN }} + ref: \${{ github.event.pull_request.head.ref }} + repository: \${{ github.event.pull_request.head.repo.full_name }} + - name: Download patch + uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a + with: + name: .repo.patch + path: \${{ runner.temp }} + - name: Apply patch + run: '[ -s \${{ runner.temp }}/.repo.patch ] && git apply \${{ runner.temp }}/.repo.patch || echo "Empty patch. Skipping."' + - name: Set git identity + run: |- + git config user.name "team-tf-cdk" + git config user.email "github-team-tf-cdk@hashicorp.com" + - name: Push changes + env: + PULL_REQUEST_REF: \${{ github.event.pull_request.head.ref }} + run: |- + git add . + git commit -s -m "chore: self mutation" + git push origin HEAD:$PULL_REQUEST_REF + package-js: + needs: build + runs-on: ubuntu-latest + permissions: {} + if: "! needs.build.outputs.self_mutation_happened" + steps: + - uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 + with: + node-version: 18.x + - name: Download build artifacts + uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a + with: + name: build-artifact + path: dist + - name: Restore build artifact permissions + run: cd dist && setfacl --restore=permissions-backup.acl + continue-on-error: true + - name: Prepare Repository + run: mv dist .repo + - name: Install Dependencies + run: cd .repo && yarn install --check-files --frozen-lockfile + - name: Create js artifact + run: cd .repo && npx projen package:js + - name: Collect js Artifact + run: mv .repo/dist dist + package-java: + needs: build + runs-on: ubuntu-latest + permissions: {} + if: "! needs.build.outputs.self_mutation_happened" + steps: + - uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0 + with: + distribution: temurin + java-version: 11.x + - uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 + with: + node-version: 18.x + - name: Download build artifacts + uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a + with: + name: build-artifact + path: dist + - name: Restore build artifact permissions + run: cd dist && setfacl --restore=permissions-backup.acl + continue-on-error: true + - name: Prepare Repository + run: mv dist .repo + - name: Install Dependencies + run: cd .repo && yarn install --check-files --frozen-lockfile + - name: Create java artifact + run: cd .repo && npx projen package:java + - name: Collect java Artifact + run: mv .repo/dist dist + package-python: + needs: build + runs-on: ubuntu-latest + permissions: {} + if: "! needs.build.outputs.self_mutation_happened" + steps: + - uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 + with: + node-version: 18.x + - uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 + with: + python-version: 3.x + - name: Download build artifacts + uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a + with: + name: build-artifact + path: dist + - name: Restore build artifact permissions + run: cd dist && setfacl --restore=permissions-backup.acl + continue-on-error: true + - name: Prepare Repository + run: mv dist .repo + - name: Install Dependencies + run: cd .repo && yarn install --check-files --frozen-lockfile + - name: Create python artifact + run: cd .repo && npx projen package:python + - name: Collect python Artifact + run: mv .repo/dist dist + package-dotnet: + needs: build + runs-on: ubuntu-latest + permissions: {} + if: "! needs.build.outputs.self_mutation_happened" + steps: + - uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 + with: + node-version: 18.x + - uses: actions/setup-dotnet@3447fd6a9f9e57506b15f895c5b76d3b197dc7c2 + with: + dotnet-version: 3.x + - name: Download build artifacts + uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a + with: + name: build-artifact + path: dist + - name: Restore build artifact permissions + run: cd dist && setfacl --restore=permissions-backup.acl + continue-on-error: true + - name: Prepare Repository + run: mv dist .repo + - name: Install Dependencies + run: cd .repo && yarn install --check-files --frozen-lockfile + - name: Create dotnet artifact + run: cd .repo && npx projen package:dotnet + - name: Collect dotnet Artifact + run: mv .repo/dist dist + package-go: + needs: build + runs-on: ubuntu-latest + permissions: {} + if: "! needs.build.outputs.self_mutation_happened" + steps: + - uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 + with: + node-version: 18.x + - uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe + with: + go-version: ^1.16.0 + - name: Download build artifacts + uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a + with: + name: build-artifact + path: dist + - name: Restore build artifact permissions + run: cd dist && setfacl --restore=permissions-backup.acl + continue-on-error: true + - name: Prepare Repository + run: mv dist .repo + - name: Install Dependencies + run: cd .repo && yarn install --check-files --frozen-lockfile + - name: Create go artifact + run: cd .repo && npx projen package:go + - name: Collect go Artifact + run: mv .repo/dist dist +", + ".github/workflows/lock.yml": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +name: lock +on: + schedule: + - cron: 20 2 * * * +jobs: + lock: + runs-on: ubuntu-latest + permissions: + pull-requests: write + issues: write + steps: + - uses: dessant/lock-threads@1bf7ec25051fe7c00bdd17e6a7cf3d7bfb7dc771 + with: + issue-comment: I'm going to lock this issue because it has been closed for at least 7 days. This helps our maintainers find and focus on the active issues. If you've found a problem that seems similar to this, please [open a new issue](https://github.com/cdktf/cdktf-provider-project/issues/new) so we can investigate further. + issue-inactive-days: 7 + pr-comment: I'm going to lock this pull request because it has been closed for at least 7 days. This helps our maintainers find and focus on the active issues. If you've found a problem that seems related to this change, please [open a new issue](https://github.com/cdktf/cdktf-provider-project/issues/new) so we can investigate further. + pr-inactive-days: 7 +", + ".github/workflows/pull-request-lint.yml": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +name: pull-request-lint +on: + pull_request_target: + types: + - labeled + - opened + - synchronize + - reopened + - ready_for_review + - edited +jobs: + validate: + name: Validate PR title + runs-on: ubuntu-latest + permissions: + pull-requests: write + steps: + - uses: amannn/action-semantic-pull-request@e9fabac35e210fea40ca5b14c0da95a099eff26f + env: + GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }} + with: + types: |- + feat + fix + chore + requireScope: false + githubBaseUrl: \${{ github.api_url }} +", + ".github/workflows/release.yml": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +name: release +on: + push: + branches: + - main + workflow_dispatch: {} +jobs: + release: + runs-on: ubuntu-latest + permissions: + contents: write + outputs: + latest_commit: \${{ steps.git_remote.outputs.latest_commit }} + env: + CI: "true" + steps: + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + with: + fetch-depth: 0 + - name: Set git config safe.directory + run: git config --global --add safe.directory $(pwd) + - name: Set git identity + run: |- + git config user.name "github-actions" + git config user.email "github-actions@github.com" + - name: Install dependencies + run: yarn install --check-files --frozen-lockfile + - name: release + run: npx projen release + - name: Check for new commits + id: git_remote + run: echo "latest_commit=$(git ls-remote origin -h \${{ github.ref }} | cut -f1)" >> $GITHUB_OUTPUT + - name: Backup artifact permissions + if: \${{ steps.git_remote.outputs.latest_commit == github.sha }} + run: cd dist && getfacl -R . > permissions-backup.acl + continue-on-error: true + - name: Upload artifact + if: \${{ steps.git_remote.outputs.latest_commit == github.sha }} + uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 + with: + name: build-artifact + path: dist + deprecate: + name: Deprecate the package in package managers if needed + needs: + - release + - release_npm + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + - name: Install + run: yarn install + - name: Check deprecation status + id: check_status + run: |- + IS_DEPRECATED=$(npm pkg get cdktf.isDeprecated | tr -d '"') + echo "is_deprecated=$IS_DEPRECATED" + echo "is_deprecated=$IS_DEPRECATED" >> $GITHUB_OUTPUT + - name: Deprecate the package on NPM + if: steps.check_status.outputs.is_deprecated + env: + NPM_REGISTRY: registry.npmjs.org + NPM_TOKEN: \${{ secrets.NPM_TOKEN }} + run: npm deprecate @cdktf/provider-random "See https://cdk.tf/imports for details on how to continue to use the random provider in your CDK for Terraform (CDKTF) projects by generating the bindings locally." + release_github: + name: Publish to GitHub Releases + needs: release + runs-on: ubuntu-latest + permissions: + contents: write + issues: write + if: needs.release.outputs.latest_commit == github.sha + steps: + - uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 + with: + node-version: 18.x + - name: Download build artifacts + uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a + with: + name: build-artifact + path: dist + - name: Restore build artifact permissions + run: cd dist && setfacl --restore=permissions-backup.acl + continue-on-error: true + - name: Prepare Repository + run: mv dist .repo + - name: Collect GitHub Metadata + run: mv .repo/dist dist + - name: Release + env: + GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }} + GITHUB_REPOSITORY: \${{ github.repository }} + GITHUB_REF: \${{ github.ref }} + run: errout=$(mktemp); gh release create $(cat dist/releasetag.txt) -R $GITHUB_REPOSITORY -F dist/changelog.md -t $(cat dist/releasetag.txt) --target $GITHUB_REF 2> $errout && true; exitcode=$?; if [ $exitcode -ne 0 ] && ! grep -q "Release.tag_name already exists" $errout; then cat $errout; exit $exitcode; fi + - name: Extract Version + id: extract-version + if: \${{ failure() }} + run: echo "VERSION=$(cat dist/version.txt)" >> $GITHUB_OUTPUT + - name: Create Issue + if: \${{ failure() }} + uses: imjohnbo/issue-bot@6924a99d928dc228f407d34eb3d0149eda73f2a7 + env: + GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }} + with: + labels: failed-release + title: Publishing v\${{ steps.extract-version.outputs.VERSION }} to GitHub Releases failed + body: See https://github.com/\${{ github.repository }}/actions/runs/\${{ github.run_id }} + release_npm: + name: Publish to npm + needs: release + runs-on: ubuntu-latest + permissions: + contents: read + issues: write + if: needs.release.outputs.latest_commit == github.sha + steps: + - uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 + with: + node-version: 18.x + - name: Download build artifacts + uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a + with: + name: build-artifact + path: dist + - name: Restore build artifact permissions + run: cd dist && setfacl --restore=permissions-backup.acl + continue-on-error: true + - name: Prepare Repository + run: mv dist .repo + - name: Install Dependencies + run: cd .repo && yarn install --check-files --frozen-lockfile + - name: Create js artifact + run: cd .repo && npx projen package:js + - name: Collect js Artifact + run: mv .repo/dist dist + - name: Release + env: + NPM_DIST_TAG: latest + NPM_REGISTRY: registry.npmjs.org + NPM_TOKEN: \${{ secrets.NPM_TOKEN }} + run: npx -p publib@latest publib-npm + - name: Extract Version + id: extract-version + if: \${{ failure() }} + run: echo "VERSION=$(cat dist/version.txt)" >> $GITHUB_OUTPUT + - name: Create Issue + if: \${{ failure() }} + uses: imjohnbo/issue-bot@6924a99d928dc228f407d34eb3d0149eda73f2a7 + env: + GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }} + with: + labels: failed-release + title: Publishing v\${{ steps.extract-version.outputs.VERSION }} to npm failed + body: See https://github.com/\${{ github.repository }}/actions/runs/\${{ github.run_id }} + release_maven: + name: Publish to Maven Central + needs: release + runs-on: ubuntu-latest + permissions: + contents: read + issues: write + if: needs.release.outputs.latest_commit == github.sha + steps: + - uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0 + with: + distribution: temurin + java-version: 11.x + - uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 + with: + node-version: 18.x + - name: Download build artifacts + uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a + with: + name: build-artifact + path: dist + - name: Restore build artifact permissions + run: cd dist && setfacl --restore=permissions-backup.acl + continue-on-error: true + - name: Prepare Repository + run: mv dist .repo + - name: Install Dependencies + run: cd .repo && yarn install --check-files --frozen-lockfile + - name: Create java artifact + run: cd .repo && npx projen package:java + - name: Collect java Artifact + run: mv .repo/dist dist + - name: Release + env: + MAVEN_ENDPOINT: https://hashicorp.oss.sonatype.org + MAVEN_GPG_PRIVATE_KEY: \${{ secrets.MAVEN_GPG_PRIVATE_KEY }} + MAVEN_GPG_PRIVATE_KEY_PASSPHRASE: \${{ secrets.MAVEN_GPG_PRIVATE_KEY_PASSPHRASE }} + MAVEN_PASSWORD: \${{ secrets.MAVEN_PASSWORD }} + MAVEN_USERNAME: \${{ secrets.MAVEN_USERNAME }} + MAVEN_STAGING_PROFILE_ID: \${{ secrets.MAVEN_STAGING_PROFILE_ID }} + MAVEN_OPTS: --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.text=ALL-UNNAMED --add-opens=java.desktop/java.awt.font=ALL-UNNAMED + run: npx -p publib@latest publib-maven + - name: Extract Version + id: extract-version + if: \${{ failure() }} + run: echo "VERSION=$(cat dist/version.txt)" >> $GITHUB_OUTPUT + - name: Create Issue + if: \${{ failure() }} + uses: imjohnbo/issue-bot@6924a99d928dc228f407d34eb3d0149eda73f2a7 + env: + GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }} + with: + labels: failed-release + title: Publishing v\${{ steps.extract-version.outputs.VERSION }} to Maven Central failed + body: See https://github.com/\${{ github.repository }}/actions/runs/\${{ github.run_id }} + release_pypi: + name: Publish to PyPI + needs: release + runs-on: ubuntu-latest + permissions: + contents: read + issues: write + if: needs.release.outputs.latest_commit == github.sha + steps: + - uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 + with: + node-version: 18.x + - uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 + with: + python-version: 3.x + - name: Download build artifacts + uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a + with: + name: build-artifact + path: dist + - name: Restore build artifact permissions + run: cd dist && setfacl --restore=permissions-backup.acl + continue-on-error: true + - name: Prepare Repository + run: mv dist .repo + - name: Install Dependencies + run: cd .repo && yarn install --check-files --frozen-lockfile + - name: Create python artifact + run: cd .repo && npx projen package:python + - name: Collect python Artifact + run: mv .repo/dist dist + - name: Release + env: + TWINE_USERNAME: \${{ secrets.TWINE_USERNAME }} + TWINE_PASSWORD: \${{ secrets.TWINE_PASSWORD }} + run: npx -p publib@latest publib-pypi + - name: Extract Version + id: extract-version + if: \${{ failure() }} + run: echo "VERSION=$(cat dist/version.txt)" >> $GITHUB_OUTPUT + - name: Create Issue + if: \${{ failure() }} + uses: imjohnbo/issue-bot@6924a99d928dc228f407d34eb3d0149eda73f2a7 + env: + GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }} + with: + labels: failed-release + title: Publishing v\${{ steps.extract-version.outputs.VERSION }} to PyPI failed + body: See https://github.com/\${{ github.repository }}/actions/runs/\${{ github.run_id }} + release_nuget: + name: Publish to NuGet Gallery + needs: release + runs-on: ubuntu-latest + permissions: + contents: read + issues: write + if: needs.release.outputs.latest_commit == github.sha + steps: + - uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 + with: + node-version: 18.x + - uses: actions/setup-dotnet@3447fd6a9f9e57506b15f895c5b76d3b197dc7c2 + with: + dotnet-version: 3.x + - name: Download build artifacts + uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a + with: + name: build-artifact + path: dist + - name: Restore build artifact permissions + run: cd dist && setfacl --restore=permissions-backup.acl + continue-on-error: true + - name: Prepare Repository + run: mv dist .repo + - name: Install Dependencies + run: cd .repo && yarn install --check-files --frozen-lockfile + - name: Create dotnet artifact + run: cd .repo && npx projen package:dotnet + - name: Collect dotnet Artifact + run: mv .repo/dist dist + - name: Release + env: + NUGET_API_KEY: \${{ secrets.NUGET_API_KEY }} + run: npx -p publib@latest publib-nuget + - name: Extract Version + id: extract-version + if: \${{ failure() }} + run: echo "VERSION=$(cat dist/version.txt)" >> $GITHUB_OUTPUT + - name: Create Issue + if: \${{ failure() }} + uses: imjohnbo/issue-bot@6924a99d928dc228f407d34eb3d0149eda73f2a7 + env: + GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }} + with: + labels: failed-release + title: Publishing v\${{ steps.extract-version.outputs.VERSION }} to NuGet Gallery failed + body: See https://github.com/\${{ github.repository }}/actions/runs/\${{ github.run_id }} + release_golang: + name: Publish to GitHub Go Module Repository + needs: release + runs-on: ubuntu-latest + permissions: + contents: read + issues: write + if: needs.release.outputs.latest_commit == github.sha + steps: + - uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 + with: + node-version: 18.x + - uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe + with: + go-version: ^1.16.0 + - name: Download build artifacts + uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a + with: + name: build-artifact + path: dist + - name: Restore build artifact permissions + run: cd dist && setfacl --restore=permissions-backup.acl + continue-on-error: true + - name: Prepare Repository + run: mv dist .repo + - name: Install Dependencies + run: cd .repo && yarn install --check-files --frozen-lockfile + - name: Create go artifact + run: cd .repo && npx projen package:go + - name: Setup Copywrite tool + uses: hashicorp/setup-copywrite@867a1a2a064a0626db322392806428f7dc59cb3e + - name: Copy copywrite hcl file + run: cp .repo/.copywrite.hcl .repo/dist/go/.copywrite.hcl + - name: Add headers using Copywrite tool + run: cd .repo/dist/go && copywrite headers + - name: Remove copywrite hcl file + run: rm -f .repo/dist/go/.copywrite.hcl + - name: Remove some text from the README that doesn't apply to Go + run: |- + sed -i 's/# CDKTF prebuilt bindings for/# CDKTF Go bindings for/' .repo/dist/go/*/README.md + sed -i -e '/## Available Packages/,/### Go/!b' -e '/### Go/!d;p; s/### Go/## Go Package/' -e 'd' .repo/dist/go/*/README.md + sed -i 's/### Go/## Deprecated Package/' .repo/dist/go/*/README.md + sed -i -e '/API.typescript.md/,/You can also visit a hosted version/!b' -e 'd' .repo/dist/go/*/README.md + sed -i 's|Find auto-generated docs for this provider here:|Find auto-generated docs for this provider [here](https://github.com/cdktf/cdktf-provider-random/blob/main/docs/API.go.md).|' .repo/dist/go/*/README.md + sed -i -e '/### Provider Version/,/The provider version can be adjusted/!b' -e 'd' .repo/dist/go/*/README.md + continue-on-error: true + - name: Copy the README file to the parent directory + run: cp .repo/dist/go/*/README.md .repo/dist/go/README.md + - name: Mark the Go module as deprecated + run: |- + find '.repo/dist/go' -mindepth 2 -maxdepth 4 -type f -name 'go.mod' | xargs sed -i '1s|^|// Deprecated: HashiCorp is no longer publishing new versions of the prebuilt provider for random. + // Previously-published versions of this prebuilt provider will still continue to be available as installable Go modules, + // but these will not be compatible with newer versions of CDK for Terraform and are not eligible for commercial support. + // You can continue to use the random provider in your CDK for Terraform projects with newer versions of CDKTF, + // but you will need to generate the bindings locally. See https://cdk.tf/imports for details. + |' + continue-on-error: true + - name: Collect go Artifact + run: mv .repo/dist dist + - name: Release + env: + GIT_USER_NAME: CDK for Terraform Team + GIT_USER_EMAIL: github-team-tf-cdk@hashicorp.com + GITHUB_TOKEN: \${{ secrets.GO_GITHUB_TOKEN }} + run: npx -p publib@latest publib-golang + - name: Extract Version + id: extract-version + if: \${{ failure() }} + run: echo "VERSION=$(cat dist/version.txt)" >> $GITHUB_OUTPUT + - name: Create Issue + if: \${{ failure() }} + uses: imjohnbo/issue-bot@6924a99d928dc228f407d34eb3d0149eda73f2a7 + env: + GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }} + with: + labels: failed-release + title: Publishing v\${{ steps.extract-version.outputs.VERSION }} to GitHub Go Module Repository failed + body: See https://github.com/\${{ github.repository }}/actions/runs/\${{ github.run_id }} +", + ".github/workflows/stale.yml": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +name: stale +on: + schedule: + - cron: 0 1 * * * + workflow_dispatch: {} +jobs: + stale: + runs-on: ubuntu-latest + permissions: + issues: write + pull-requests: write + steps: + - uses: actions/stale@1160a2240286f5da8ec72b1c0816ce2481aabf84 + with: + days-before-stale: -1 + days-before-close: -1 + days-before-pr-stale: 1 + days-before-pr-close: 0 + stale-pr-message: Closing this PR, if it has not merged there is most likely a CI or CDKTF issue preventing it from merging. If this has been a manual PR, please reopen it and add the \`no-auto-close\` label to prevent this from happening again. + close-pr-message: Closing this pull request as it hasn't seen activity for a while. Please add a comment @mentioning a maintainer to reopen. If you wish to exclude this issue from being marked as stale, add the "no-auto-close" label. + stale-pr-label: stale + exempt-pr-labels: no-auto-close + days-before-issue-stale: 45 + days-before-issue-close: 14 + stale-issue-message: 45 days have passed since this issue was opened, and I assume other publishes have succeeded in the meantime. If no one removes the \`stale\` label or comments, I'm going to auto-close this issue in 14 days. + close-issue-message: 2 months have passed, so I'm closing this issue with the assumption that other publishes have succeeded in the meantime. + stale-issue-label: stale + exempt-issue-labels: backlog +", + ".gitignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +!/.gitattributes +!/.projen/tasks.json +!/.projen/deps.json +!/.projen/files.json +!/.github/workflows/pull-request-lint.yml +!/.github/workflows/stale.yml +!/package.json +!/.npmignore +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json +pids +*.pid +*.seed +*.pid.lock +lib-cov +coverage +*.lcov +.nyc_output +build/Release +node_modules/ +jspm_packages/ +*.tsbuildinfo +.eslintcache +*.tgz +.yarn-integrity +.cache +!/.projenrc.js +!/.github/workflows/build.yml +/dist/changelog.md +/dist/version.txt +!/.github/workflows/release.yml +!/.github/pull_request_template.md +!/test/ +!/tsconfig.dev.json +!/src/ +/lib +/dist/ +.jsii +tsconfig.json +.gen +.terraform +package-lock.json +!/cdktf.json +!/README.md +!/LICENSE +!/.github/ISSUE_TEMPLATE/config.yml +!/.github/workflows/auto-approve.yml +!/.github/workflows/auto-close-community-issues.yml +!/.github/workflows/auto-close-community-prs.yml +!/.github/workflows/automerge.yml +!/.github/workflows/lock.yml +!/.github/CODEOWNERS +API.md +!/docs/*.md +!/.copywrite.hcl +", + ".npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +/.projen/ +permissions-backup.acl +/dist/changelog.md +/dist/version.txt +/test/ +/tsconfig.dev.json +/src/ +!/lib/ +!/lib/**/*.js +!/lib/**/*.d.ts +dist +/tsconfig.json +/.github/ +/.vscode/ +/.idea/ +/.projenrc.js +tsconfig.tsbuildinfo +!.jsii +.gen +.terraform +cdktf.json +API.md +docs +scripts +.projenrc.js +.copywrite.hcl +", + ".projen/deps.json": "{ + "dependencies": [ + { + "name": "@actions/core", + "version": "^1.1.0", + "type": "build" + }, + { + "name": "@cdktf/provider-project", + "version": "^0.0.0", + "type": "build" + }, + { + "name": "@types/node", + "version": "^16", + "type": "build" + }, + { + "name": "cdktf-cli", + "version": "0.10.3", + "type": "build" + }, + { + "name": "cdktf", + "version": "0.10.3", + "type": "build" + }, + { + "name": "constructs", + "version": "10.0.0", + "type": "build" + }, + { + "name": "dot-prop", + "version": "^5.2.0", + "type": "build" + }, + { + "name": "jsii-diff", + "type": "build" + }, + { + "name": "jsii-docgen", + "version": "^10.2.3", + "type": "build" + }, + { + "name": "jsii-pacmak", + "type": "build" + }, + { + "name": "jsii-rosetta", + "version": "~5.2.0", + "type": "build" + }, + { + "name": "jsii", + "version": "1.x", + "type": "build" + }, + { + "name": "projen", + "type": "build" + }, + { + "name": "standard-version", + "version": "^9", + "type": "build" + }, + { + "name": "typescript", + "type": "build" + }, + { + "name": "@types/babel__traverse", + "version": "7.18.2", + "type": "override" + }, + { + "name": "@types/prettier", + "version": "2.6.0", + "type": "override" + }, + { + "name": "@types/yargs", + "version": "17.0.13", + "type": "override" + }, + { + "name": "cdktf", + "version": "0.10.3", + "type": "peer" + }, + { + "name": "constructs", + "version": "10.0.0", + "type": "peer" + } + ], + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run \\"npx projen\\"." +} +", + ".projen/files.json": "{ + "files": [ + ".copywrite.hcl", + ".gitattributes", + ".github/CODEOWNERS", + ".github/ISSUE_TEMPLATE/config.yml", + ".github/pull_request_template.md", + ".github/workflows/auto-approve.yml", + ".github/workflows/auto-close-community-issues.yml", + ".github/workflows/auto-close-community-prs.yml", + ".github/workflows/automerge.yml", + ".github/workflows/build.yml", + ".github/workflows/lock.yml", + ".github/workflows/pull-request-lint.yml", + ".github/workflows/release.yml", + ".github/workflows/stale.yml", + ".gitignore", + ".projen/deps.json", + ".projen/files.json", + ".projen/tasks.json", + "cdktf.json", + "LICENSE", + "README.md", + "tsconfig.dev.json" + ], + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run \\"npx projen\\"." +} +", + ".projen/tasks.json": "{ + "tasks": { + "build": { + "name": "build", + "description": "Full release build", + "steps": [ + { + "spawn": "default" + }, + { + "spawn": "pre-compile" + }, + { + "spawn": "compile" + }, + { + "spawn": "post-compile" + }, + { + "spawn": "test" + }, + { + "spawn": "package" + } + ] + }, + "bump": { + "name": "bump", + "description": "Bumps version based on latest git tag and generates a changelog entry", + "env": { + "OUTFILE": "package.json", + "CHANGELOG": "dist/changelog.md", + "BUMPFILE": "dist/version.txt", + "RELEASETAG": "dist/releasetag.txt", + "RELEASE_TAG_PREFIX": "" + }, + "steps": [ + { + "builtin": "release/bump-version" + } + ], + "condition": "! git log --oneline -1 | grep -q \\"chore(release):\\"" + }, + "clobber": { + "name": "clobber", + "description": "hard resets to HEAD of origin and cleans the local repo", + "env": { + "BRANCH": "$(git branch --show-current)" + }, + "steps": [ + { + "exec": "git checkout -b scratch", + "name": "save current HEAD in \\"scratch\\" branch" + }, + { + "exec": "git checkout $BRANCH" + }, + { + "exec": "git fetch origin", + "name": "fetch latest changes from origin" + }, + { + "exec": "git reset --hard origin/$BRANCH", + "name": "hard reset to origin commit" + }, + { + "exec": "git clean -fdx", + "name": "clean all untracked files" + }, + { + "say": "ready to rock! (unpushed commits are under the \\"scratch\\" branch)" + } + ], + "condition": "git diff --exit-code > /dev/null" + }, + "compat": { + "name": "compat", + "description": "Perform API compatibility check against latest version", + "steps": [ + { + "exec": "jsii-diff npm:$(node -p \\"require('./package.json').name\\") -k --ignore-file .compatignore || (echo \\"\\nUNEXPECTED BREAKING CHANGES: add keys such as 'removed:constructs.Node.of' to .compatignore to skip.\\n\\" && exit 1)" + } + ] + }, + "compile": { + "name": "compile", + "description": "Only compile", + "steps": [ + { + "exec": "jsii --silence-warnings=reserved-word" + } + ] + }, + "default": { + "name": "default", + "description": "Synthesize project files", + "steps": [ + { + "exec": "node .projenrc.js" + } + ] + }, + "docgen": { + "name": "docgen", + "description": "Generate documentation for the project", + "steps": [ + { + "exec": "rm -rf docs && rm -f API.md && mkdir docs && jsii-docgen --split-by-submodule -l typescript -l python -l java -l csharp -l go && mv *.*.md docs && cd docs && ls ./ | xargs sed -i '150000,$ d' $1" + } + ] + }, + "eject": { + "name": "eject", + "description": "Remove projen from the project", + "env": { + "PROJEN_EJECTING": "true" + }, + "steps": [ + { + "spawn": "default" + } + ] + }, + "fetch": { + "name": "fetch", + "env": { + "CHECKPOINT_DISABLE": "1" + }, + "steps": [ + { + "exec": "mkdir -p src && rm -rf ./src/* && cdktf get && cp -R .gen/providers/random/* ./src/ && cp .gen/versions.json ./src/version.json" + }, + { + "spawn": "default" + } + ] + }, + "install": { + "name": "install", + "description": "Install project dependencies and update lockfile (non-frozen)", + "steps": [ + { + "exec": "yarn install --check-files" + } + ] + }, + "install:ci": { + "name": "install:ci", + "description": "Install project dependencies using frozen lockfile", + "steps": [ + { + "exec": "yarn install --check-files --frozen-lockfile" + } + ] + }, + "package": { + "name": "package", + "description": "Creates the distribution package", + "steps": [ + { + "exec": "if [ ! -z \${CI} ]; then rsync -a . .repo --exclude .git --exclude node_modules && rm -rf dist && mv .repo dist; else npx projen package-all; fi" + } + ] + }, + "package-all": { + "name": "package-all", + "description": "Packages artifacts for all target languages", + "steps": [ + { + "spawn": "package:js" + }, + { + "spawn": "package:java" + }, + { + "spawn": "package:python" + }, + { + "spawn": "package:dotnet" + }, + { + "spawn": "package:go" + } + ] + }, + "package:dotnet": { + "name": "package:dotnet", + "description": "Create dotnet language bindings", + "steps": [ + { + "exec": "jsii-pacmak -v --target dotnet" + } + ] + }, + "package:go": { + "name": "package:go", + "description": "Create go language bindings", + "steps": [ + { + "exec": "jsii-pacmak -v --target go" + } + ] + }, + "package:java": { + "name": "package:java", + "description": "Create java language bindings", + "steps": [ + { + "exec": "jsii-pacmak -v --target java" + } + ] + }, + "package:js": { + "name": "package:js", + "description": "Create js language bindings", + "steps": [ + { + "exec": "jsii-pacmak -v --target js" + } + ] + }, + "package:python": { + "name": "package:python", + "description": "Create python language bindings", + "steps": [ + { + "exec": "jsii-pacmak -v --target python" + } + ] + }, + "post-compile": { + "name": "post-compile", + "description": "Runs after successful compilation", + "steps": [ + { + "spawn": "docgen" + } + ] + }, + "pre-compile": { + "name": "pre-compile", + "description": "Prepare the project for compilation", + "steps": [ + { + "spawn": "unconditional-bump" + } + ] + }, + "release": { + "name": "release", + "description": "Prepare a release from \\"main\\" branch", + "env": { + "RELEASE": "true", + "MIN_MAJOR": "1" + }, + "steps": [ + { + "exec": "rm -fr dist" + }, + { + "spawn": "bump" + }, + { + "spawn": "build" + }, + { + "spawn": "unbump" + }, + { + "exec": "git diff --ignore-space-at-eol --exit-code" + } + ] + }, + "test": { + "name": "test", + "description": "Run tests" + }, + "unbump": { + "name": "unbump", + "description": "Restores version to 0.0.0", + "env": { + "OUTFILE": "package.json", + "CHANGELOG": "dist/changelog.md", + "BUMPFILE": "dist/version.txt", + "RELEASETAG": "dist/releasetag.txt", + "RELEASE_TAG_PREFIX": "" + }, + "steps": [ + { + "builtin": "release/reset-version" + } + ] + }, + "unconditional-bump": { + "name": "unconditional-bump", + "description": "Set the version in package.json to the current version", + "env": { + "OUTFILE": "package.json", + "CHANGELOG": "dist/changelog.md", + "BUMPFILE": "dist/version.txt", + "RELEASETAG": "dist/releasetag.txt", + "RELEASE_TAG_PREFIX": "", + "MIN_MAJOR": "1" + }, + "steps": [ + { + "name": "Clear the changelog so that it doesn't get published twice", + "exec": "rm -f $CHANGELOG" + }, + { + "builtin": "release/bump-version" + } + ] + }, + "watch": { + "name": "watch", + "description": "Watch & compile in the background", + "steps": [ + { + "exec": "jsii -w --silence-warnings=reserved-word" + } + ] + } + }, + "env": { + "PATH": "$(npx -c \\"node --print process.env.PATH\\")", + "NODE_OPTIONS": "--max-old-space-size=6656", + "CHECKPOINT_DISABLE": "1" + }, + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run \\"npx projen\\"." +} +", + "LICENSE": "Copyright (c) 2023 HashiCorp, Inc. + +Mozilla Public License, version 2.0 + +1. Definitions + +1.1. “Contributor” + + means each individual or legal entity that creates, contributes to the + creation of, or owns Covered Software. + +1.2. “Contributor Version” + + means the combination of the Contributions of others (if any) used by a + Contributor and that particular Contributor’s Contribution. + +1.3. “Contribution” + + means Covered Software of a particular Contributor. + +1.4. “Covered Software” + + means Source Code Form to which the initial Contributor has attached the + notice in Exhibit A, the Executable Form of such Source Code Form, and + Modifications of such Source Code Form, in each case including portions + thereof. + +1.5. “Incompatible With Secondary Licenses” + means + + a. that the initial Contributor has attached the notice described in + Exhibit B to the Covered Software; or + + b. that the Covered Software was made available under the terms of version + 1.1 or earlier of the License, but not also under the terms of a + Secondary License. + +1.6. “Executable Form” + + means any form of the work other than Source Code Form. + +1.7. “Larger Work” + + means a work that combines Covered Software with other material, in a separate + file or files, that is not Covered Software. + +1.8. “License” + + means this document. + +1.9. “Licensable” + + means having the right to grant, to the maximum extent possible, whether at the + time of the initial grant or subsequently, any and all of the rights conveyed by + this License. + +1.10. “Modifications” + + means any of the following: + + a. any file in Source Code Form that results from an addition to, deletion + from, or modification of the contents of Covered Software; or + + b. any new file in Source Code Form that contains any Covered Software. + +1.11. “Patent Claims” of a Contributor + + means any patent claim(s), including without limitation, method, process, + and apparatus claims, in any patent Licensable by such Contributor that + would be infringed, but for the grant of the License, by the making, + using, selling, offering for sale, having made, import, or transfer of + either its Contributions or its Contributor Version. + +1.12. “Secondary License” + + means either the GNU General Public License, Version 2.0, the GNU Lesser + General Public License, Version 2.1, the GNU Affero General Public + License, Version 3.0, or any later versions of those licenses. + +1.13. “Source Code Form” + + means the form of the work preferred for making modifications. + +1.14. “You” (or “Your”) + + means an individual or a legal entity exercising rights under this + License. For legal entities, “You” includes any entity that controls, is + controlled by, or is under common control with You. For purposes of this + definition, “control” means (a) the power, direct or indirect, to cause + the direction or management of such entity, whether by contract or + otherwise, or (b) ownership of more than fifty percent (50%) of the + outstanding shares or beneficial ownership of such entity. + + +2. License Grants and Conditions + +2.1. Grants + + Each Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + a. under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or as + part of a Larger Work; and + + b. under Patent Claims of such Contributor to make, use, sell, offer for + sale, have made, import, and otherwise transfer either its Contributions + or its Contributor Version. + +2.2. Effective Date + + The licenses granted in Section 2.1 with respect to any Contribution become + effective for each Contribution on the date the Contributor first distributes + such Contribution. + +2.3. Limitations on Grant Scope + + The licenses granted in this Section 2 are the only rights granted under this + License. No additional rights or licenses will be implied from the distribution + or licensing of Covered Software under this License. Notwithstanding Section + 2.1(b) above, no patent license is granted by a Contributor: + + a. for any code that a Contributor has removed from Covered Software; or + + b. for infringements caused by: (i) Your and any other third party’s + modifications of Covered Software, or (ii) the combination of its + Contributions with other software (except as part of its Contributor + Version); or + + c. under Patent Claims infringed by Covered Software in the absence of its + Contributions. + + This License does not grant any rights in the trademarks, service marks, or + logos of any Contributor (except as may be necessary to comply with the + notice requirements in Section 3.4). + +2.4. Subsequent Licenses + + No Contributor makes additional grants as a result of Your choice to + distribute the Covered Software under a subsequent version of this License + (see Section 10.2) or under the terms of a Secondary License (if permitted + under the terms of Section 3.3). + +2.5. Representation + + Each Contributor represents that the Contributor believes its Contributions + are its original creation(s) or it has sufficient rights to grant the + rights to its Contributions conveyed by this License. + +2.6. Fair Use + + This License is not intended to limit any rights You have under applicable + copyright doctrines of fair use, fair dealing, or other equivalents. + +2.7. Conditions + + Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in + Section 2.1. + + +3. Responsibilities + +3.1. Distribution of Source Form + + All distribution of Covered Software in Source Code Form, including any + Modifications that You create or to which You contribute, must be under the + terms of this License. You must inform recipients that the Source Code Form + of the Covered Software is governed by the terms of this License, and how + they can obtain a copy of this License. You may not attempt to alter or + restrict the recipients’ rights in the Source Code Form. + +3.2. Distribution of Executable Form + + If You distribute Covered Software in Executable Form then: + + a. such Covered Software must also be made available in Source Code Form, + as described in Section 3.1, and You must inform recipients of the + Executable Form how they can obtain a copy of such Source Code Form by + reasonable means in a timely manner, at a charge no more than the cost + of distribution to the recipient; and + + b. You may distribute such Executable Form under the terms of this License, + or sublicense it under different terms, provided that the license for + the Executable Form does not attempt to limit or alter the recipients’ + rights in the Source Code Form under this License. + +3.3. Distribution of a Larger Work + + You may create and distribute a Larger Work under terms of Your choice, + provided that You also comply with the requirements of this License for the + Covered Software. If the Larger Work is a combination of Covered Software + with a work governed by one or more Secondary Licenses, and the Covered + Software is not Incompatible With Secondary Licenses, this License permits + You to additionally distribute such Covered Software under the terms of + such Secondary License(s), so that the recipient of the Larger Work may, at + their option, further distribute the Covered Software under the terms of + either this License or such Secondary License(s). + +3.4. Notices + + You may not remove or alter the substance of any license notices (including + copyright notices, patent notices, disclaimers of warranty, or limitations + of liability) contained within the Source Code Form of the Covered + Software, except that You may alter any license notices to the extent + required to remedy known factual inaccuracies. + +3.5. Application of Additional Terms + + You may choose to offer, and to charge a fee for, warranty, support, + indemnity or liability obligations to one or more recipients of Covered + Software. However, You may do so only on Your own behalf, and not on behalf + of any Contributor. You must make it absolutely clear that any such + warranty, support, indemnity, or liability obligation is offered by You + alone, and You hereby agree to indemnify every Contributor for any + liability incurred by such Contributor as a result of warranty, support, + indemnity or liability terms You offer. You may include additional + disclaimers of warranty and limitations of liability specific to any + jurisdiction. + +4. Inability to Comply Due to Statute or Regulation + + If it is impossible for You to comply with any of the terms of this License + with respect to some or all of the Covered Software due to statute, judicial + order, or regulation then You must: (a) comply with the terms of this License + to the maximum extent possible; and (b) describe the limitations and the code + they affect. Such description must be placed in a text file included with all + distributions of the Covered Software under this License. Except to the + extent prohibited by statute or regulation, such description must be + sufficiently detailed for a recipient of ordinary skill to be able to + understand it. + +5. Termination + +5.1. The rights granted under this License will terminate automatically if You + fail to comply with any of its terms. However, if You become compliant, + then the rights granted under this License from a particular Contributor + are reinstated (a) provisionally, unless and until such Contributor + explicitly and finally terminates Your grants, and (b) on an ongoing basis, + if such Contributor fails to notify You of the non-compliance by some + reasonable means prior to 60 days after You have come back into compliance. + Moreover, Your grants from a particular Contributor are reinstated on an + ongoing basis if such Contributor notifies You of the non-compliance by + some reasonable means, this is the first time You have received notice of + non-compliance with this License from such Contributor, and You become + compliant prior to 30 days after Your receipt of the notice. + +5.2. If You initiate litigation against any entity by asserting a patent + infringement claim (excluding declaratory judgment actions, counter-claims, + and cross-claims) alleging that a Contributor Version directly or + indirectly infringes any patent, then the rights granted to You by any and + all Contributors for the Covered Software under Section 2.1 of this License + shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user + license agreements (excluding distributors and resellers) which have been + validly granted by You or Your distributors under this License prior to + termination shall survive termination. + +6. Disclaimer of Warranty + + Covered Software is provided under this License on an “as is” basis, without + warranty of any kind, either expressed, implied, or statutory, including, + without limitation, warranties that the Covered Software is free of defects, + merchantable, fit for a particular purpose or non-infringing. The entire + risk as to the quality and performance of the Covered Software is with You. + Should any Covered Software prove defective in any respect, You (not any + Contributor) assume the cost of any necessary servicing, repair, or + correction. This disclaimer of warranty constitutes an essential part of this + License. No use of any Covered Software is authorized under this License + except under this disclaimer. + +7. Limitation of Liability + + Under no circumstances and under no legal theory, whether tort (including + negligence), contract, or otherwise, shall any Contributor, or anyone who + distributes Covered Software as permitted above, be liable to You for any + direct, indirect, special, incidental, or consequential damages of any + character including, without limitation, damages for lost profits, loss of + goodwill, work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses, even if such party shall have been + informed of the possibility of such damages. This limitation of liability + shall not apply to liability for death or personal injury resulting from such + party’s negligence to the extent applicable law prohibits such limitation. + Some jurisdictions do not allow the exclusion or limitation of incidental or + consequential damages, so this exclusion and limitation may not apply to You. + +8. Litigation + + Any litigation relating to this License may be brought only in the courts of + a jurisdiction where the defendant maintains its principal place of business + and such litigation shall be governed by laws of that jurisdiction, without + reference to its conflict-of-law provisions. Nothing in this Section shall + prevent a party’s ability to bring cross-claims or counter-claims. + +9. Miscellaneous + + This License represents the complete agreement concerning the subject matter + hereof. If any provision of this License is held to be unenforceable, such + provision shall be reformed only to the extent necessary to make it + enforceable. Any law or regulation which provides that the language of a + contract shall be construed against the drafter shall not be used to construe + this License against a Contributor. + + +10. Versions of the License + +10.1. New Versions + + Mozilla Foundation is the license steward. Except as provided in Section + 10.3, no one other than the license steward has the right to modify or + publish new versions of this License. Each version will be given a + distinguishing version number. + +10.2. Effect of New Versions + + You may distribute the Covered Software under the terms of the version of + the License under which You originally received the Covered Software, or + under the terms of any subsequent version published by the license + steward. + +10.3. Modified Versions + + If you create software not governed by this License, and you want to + create a new license for such software, you may create and use a modified + version of this License if you rename the license and remove any + references to the name of the license steward (except to note that such + modified license differs from this License). + +10.4. Distributing Source Code Form that is Incompatible With Secondary Licenses + If You choose to distribute Source Code Form that is Incompatible With + Secondary Licenses under the terms of this version of the License, the + notice described in Exhibit B of this License must be attached. + +Exhibit A - Source Code Form License Notice + + This Source Code Form is subject to the + terms of the Mozilla Public License, v. + 2.0. If a copy of the MPL was not + distributed with this file, You can + obtain one at + http://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular file, then +You may include the notice in a location (such as a LICENSE file in a relevant +directory) where a recipient would be likely to look for such a notice. + +You may add additional accurate notices of copyright ownership. + +Exhibit B - “Incompatible With Secondary Licenses” Notice + + This Source Code Form is “Incompatible + With Secondary Licenses”, as defined by + the Mozilla Public License, v. 2.0. +", + "README.md": " +# CDKTF prebuilt bindings for hashicorp/random provider version ~>2.0 + +HashiCorp made the decision to stop publishing new versions of prebuilt [Terraform random provider](https://registry.terraform.io/providers/hashicorp/random/2.0.0) bindings for [CDK for Terraform](https://cdk.tf) on December 11, 2023. As such, this repository has been archived and is no longer supported in any way by HashiCorp. Previously-published versions of this prebuilt provider will still continue to be available on their respective package managers (e.g. npm, PyPi, Maven, NuGet), but these will not be compatible with new releases of \`cdktf\` past \`0.10.3\` and are no longer eligible for commercial support. + +As a reminder, you can continue to use the \`hashicorp/random\` provider in your CDK for Terraform (CDKTF) projects, even with newer versions of CDKTF, but you will need to generate the bindings locally. The easiest way to do so is to use the [\`provider add\` command](https://developer.hashicorp.com/terraform/cdktf/cli-reference/commands#provider-add), optionally with the \`--force-local\` flag enabled: + + cdktf provider add hashicorp/random --force-local + +For more information and additional examples, check out our documentation on [generating provider bindings manually](https://cdk.tf/imports). + +## Deprecated Packages + +### NPM + +The npm package is available at [https://www.npmjs.com/package/@cdktf/provider-random](https://www.npmjs.com/package/@cdktf/provider-random). + +\`npm install @cdktf/provider-random\` + +### PyPI + +The PyPI package is available at [https://pypi.org/project/cdktf-cdktf-provider-random](https://pypi.org/project/cdktf-cdktf-provider-random). + +\`pipenv install cdktf-cdktf-provider-random\` + +### Nuget + +The Nuget package is available at [https://www.nuget.org/packages/HashiCorp.Cdktf.Providers.Random](https://www.nuget.org/packages/HashiCorp.Cdktf.Providers.Random). + +\`dotnet add package HashiCorp.Cdktf.Providers.Random\` + +### Maven + +The Maven package is available at [https://mvnrepository.com/artifact/com.hashicorp/cdktf-provider-random](https://mvnrepository.com/artifact/com.hashicorp/cdktf-provider-random). + +\`\`\` + + com.hashicorp + cdktf-provider-random + [REPLACE WITH DESIRED VERSION] + +\`\`\` + +### Go + +The go package is generated into the [\`github.com/cdktf/cdktf-provider-random-go\`](https://github.com/cdktf/cdktf-provider-random-go) package. + +\`go get github.com/cdktf/cdktf-provider-random-go/random\` + +## Docs + +Find auto-generated docs for this provider here: + +- [Typescript](./docs/API.typescript.md) +- [Python](./docs/API.python.md) +- [Java](./docs/API.java.md) +- [C#](./docs/API.csharp.md) +- [Go](./docs/API.go.md) + +You can also visit a hosted version of the documentation on [constructs.dev](https://constructs.dev/packages/@cdktf/provider-random). +", + "cdktf.json": "{ + "language": "typescript", + "app": "echo noop", + "sendCrashReports": false, + "terraformProviders": [ + "random@~>2.0" + ], + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run \\"npx projen\\"." +} +", + "package.json": "{ + "name": "@cdktf/provider-random", + "description": "Prebuilt random Provider for Terraform CDK (cdktf)", + "repository": { + "type": "git", + "url": "https://github.com/cdktf/cdktf-provider-random.git" + }, + "scripts": { + "build": "npx projen build", + "bump": "npx projen bump", + "clobber": "npx projen clobber", + "compat": "npx projen compat", + "compile": "jsii --silence-warnings=reserved-word", + "default": "npx projen default", + "docgen": "npx projen docgen", + "eject": "npx projen eject", + "fetch": "npx projen fetch", + "package": "npx projen package", + "package-all": "npx projen package-all", + "package:dotnet": "npx projen package:dotnet", + "package:go": "npx projen package:go", + "package:java": "npx projen package:java", + "package:js": "npx projen package:js", + "package:python": "npx projen package:python", + "post-compile": "npx projen post-compile", + "pre-compile": "npx projen pre-compile", + "release": "npx projen release", + "test": "jest --passWithNoTests", + "unbump": "npx projen unbump", + "unconditional-bump": "npx projen unconditional-bump", + "watch": "npx projen watch", + "projen": "npx projen", + "commit": "git add -A && git commit -am \\"Update provider\\" || echo \\"No changes to commit\\"", + "should-release": "! git diff --exit-code v$(cat version.json | jq -r '.version') ./src ./package.json", + "prebump": "yarn fetch && yarn compile && yarn run commit && yarn run should-release", + "build-provider": "yarn fetch && yarn compile && yarn docgen" + }, + "author": { + "name": "HashiCorp", + "url": "https://hashicorp.com", + "organization": true + }, + "devDependencies": { + "@actions/core": "^1.1.0", + "@cdktf/provider-project": "^0.0.0", + "@types/node": "^16", + "cdktf": "0.10.3", + "cdktf-cli": "0.10.3", + "constructs": "10.0.0", + "dot-prop": "^5.2.0", + "jsii": "1.x", + "jsii-diff": "*", + "jsii-docgen": "^10.2.3", + "jsii-pacmak": "*", + "jsii-rosetta": "~5.2.0", + "projen": "*", + "standard-version": "^9", + "typescript": "*" + }, + "peerDependencies": { + "cdktf": "0.10.3", + "constructs": "10.0.0" + }, + "resolutions": { + "@types/babel__traverse": "7.18.2", + "@types/prettier": "2.6.0", + "@types/yargs": "17.0.13" + }, + "keywords": [ + "cdk", + "cdktf", + "provider", + "random", + "terraform" + ], + "main": "lib/index.js", + "license": "MPL-2.0", + "publishConfig": { + "access": "public" + }, + "version": "0.0.0", + "types": "lib/index.d.ts", + "stability": "stable", + "jsii": { + "outdir": "dist", + "targets": { + "java": { + "package": "com.hashicorp.cdktf.providers.random_provider", + "maven": { + "groupId": "com.hashicorp", + "artifactId": "cdktf-provider-random" + } + }, + "python": { + "distName": "cdktf-cdktf-provider-random", + "module": "cdktf_cdktf_provider_random" + }, + "dotnet": { + "namespace": "HashiCorp.Cdktf.Providers.Random", + "packageId": "HashiCorp.Cdktf.Providers.Random" + }, + "go": { + "moduleName": "github.com/cdktf/cdktf-provider-random-go", + "packageName": "random" + } + }, + "tsc": { + "outDir": "lib", + "rootDir": "src" + } + }, + "standard-version": { + "types": [ + { + "type": "feat", + "section": "Features" + }, + { + "type": "fix", + "section": "Bug Fixes" + }, + { + "type": "chore", + "section": "Updates" + }, + { + "type": "docs", + "hidden": true + }, + { + "type": "style", + "hidden": true + }, + { + "type": "refactor", + "hidden": true + }, + { + "type": "perf", + "hidden": true + }, + { + "type": "test", + "hidden": true + } + ] + }, + "cdktf": { + "isDeprecated": true, + "provider": { + "name": "", + "version": "" + } + }, + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run \\"npx projen\\"." +} +", + "tsconfig.dev.json": "// ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +{ + "compilerOptions": { + "alwaysStrict": true, + "declaration": true, + "esModuleInterop": true, + "experimentalDecorators": true, + "inlineSourceMap": true, + "inlineSources": true, + "lib": [ + "es2019" + ], + "module": "CommonJS", + "noEmitOnError": false, + "noFallthroughCasesInSwitch": true, + "noImplicitAny": true, + "noImplicitReturns": true, + "noImplicitThis": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "resolveJsonModule": true, + "strict": true, + "strictNullChecks": true, + "strictPropertyInitialization": true, + "stripInternal": true, + "target": "ES2019" + }, + "include": [ + ".projenrc.js", + "src/**/*.ts", + "test/**/*.ts" + ], + "exclude": [ + "node_modules" + ] +} +", +} +`; + exports[`synths with an advanced version range syntax 1`] = ` { ".copywrite.hcl": "schema_version = 1 @@ -720,6 +2777,31 @@ jobs: with: name: build-artifact path: dist + deprecate: + name: Deprecate the package in package managers if needed + needs: + - release + - release_npm + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + - name: Install + run: yarn install + - name: Check deprecation status + id: check_status + run: |- + IS_DEPRECATED=$(npm pkg get cdktf.isDeprecated | tr -d '"') + echo "is_deprecated=$IS_DEPRECATED" + echo "is_deprecated=$IS_DEPRECATED" >> $GITHUB_OUTPUT + - name: Deprecate the package on NPM + if: steps.check_status.outputs.is_deprecated + env: + NPM_REGISTRY: registry.npmjs.org + NPM_TOKEN: \${{ secrets.NPM_TOKEN }} + run: npm deprecate @cdktf/provider-random "See https://cdk.tf/imports for details on how to continue to use the random provider in your CDK for Terraform (CDKTF) projects by generating the bindings locally." release_github: name: Publish to GitHub Releases needs: release @@ -1206,8 +3288,6 @@ tsconfig.json package-lock.json !/cdktf.json !/README.md -!/scripts/check-for-upgrades.js -!/.github/workflows/provider-upgrade.yml !/LICENSE !/.github/ISSUE_TEMPLATE/config.yml !/.github/workflows/auto-approve.yml @@ -1215,6 +3295,8 @@ package-lock.json !/.github/workflows/auto-close-community-prs.yml !/.github/workflows/automerge.yml !/.github/workflows/lock.yml +!/scripts/check-for-upgrades.js +!/.github/workflows/provider-upgrade.yml !/.github/workflows/alert-open-prs.yml !/.github/workflows/force-release.yml !/.github/CODEOWNERS @@ -2154,7 +4236,6 @@ The Maven package is available at [https://mvnrepository.com/artifact/com.hashic \`\`\` - ### Go The go package is generated into the [\`github.com/cdktf/cdktf-provider-random-go\`](https://github.com/cdktf/cdktf-provider-random-go) package. @@ -2372,6 +4453,7 @@ The repository is managed by [CDKTF Repository Manager](https://github.com/cdktf ] }, "cdktf": { + "isDeprecated": false, "provider": { "name": "", "version": "" @@ -3403,6 +5485,31 @@ jobs: with: name: build-artifact path: dist + deprecate: + name: Deprecate the package in package managers if needed + needs: + - release + - release_npm + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + - name: Install + run: yarn install + - name: Check deprecation status + id: check_status + run: |- + IS_DEPRECATED=$(npm pkg get cdktf.isDeprecated | tr -d '"') + echo "is_deprecated=$IS_DEPRECATED" + echo "is_deprecated=$IS_DEPRECATED" >> $GITHUB_OUTPUT + - name: Deprecate the package on NPM + if: steps.check_status.outputs.is_deprecated + env: + NPM_REGISTRY: registry.npmjs.org + NPM_TOKEN: \${{ secrets.NPM_TOKEN }} + run: npm deprecate @cdktf/provider-random "See https://cdk.tf/imports for details on how to continue to use the random provider in your CDK for Terraform (CDKTF) projects by generating the bindings locally." release_github: name: Publish to GitHub Releases needs: release @@ -3907,8 +6014,6 @@ tsconfig.json package-lock.json !/cdktf.json !/README.md -!/scripts/check-for-upgrades.js -!/.github/workflows/provider-upgrade.yml !/LICENSE !/.github/ISSUE_TEMPLATE/config.yml !/.github/workflows/auto-approve.yml @@ -3916,6 +6021,8 @@ package-lock.json !/.github/workflows/auto-close-community-prs.yml !/.github/workflows/automerge.yml !/.github/workflows/lock.yml +!/scripts/check-for-upgrades.js +!/.github/workflows/provider-upgrade.yml !/.github/workflows/alert-open-prs.yml !/.github/workflows/force-release.yml !/.github/CODEOWNERS @@ -4855,7 +6962,6 @@ The Maven package is available at [https://mvnrepository.com/artifact/com.hashic \`\`\` - ### Go The go package is generated into the [\`github.com/cdktf/cdktf-provider-random-go\`](https://github.com/cdktf/cdktf-provider-random-go) package. @@ -5073,6 +7179,7 @@ The repository is managed by [CDKTF Repository Manager](https://github.com/cdktf ] }, "cdktf": { + "isDeprecated": false, "provider": { "name": "", "version": "" @@ -6071,6 +8178,31 @@ jobs: with: name: build-artifact path: dist + deprecate: + name: Deprecate the package in package managers if needed + needs: + - release + - release_npm + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + - name: Install + run: yarn install + - name: Check deprecation status + id: check_status + run: |- + IS_DEPRECATED=$(npm pkg get cdktf.isDeprecated | tr -d '"') + echo "is_deprecated=$IS_DEPRECATED" + echo "is_deprecated=$IS_DEPRECATED" >> $GITHUB_OUTPUT + - name: Deprecate the package on NPM + if: steps.check_status.outputs.is_deprecated + env: + NPM_REGISTRY: registry.npmjs.org + NPM_TOKEN: \${{ secrets.NPM_TOKEN }} + run: npm deprecate @cdktf/provider-random "See https://cdk.tf/imports for details on how to continue to use the random provider in your CDK for Terraform (CDKTF) projects by generating the bindings locally." release_github: name: Publish to GitHub Releases needs: release @@ -6557,8 +8689,6 @@ tsconfig.json package-lock.json !/cdktf.json !/README.md -!/scripts/check-for-upgrades.js -!/.github/workflows/provider-upgrade.yml !/LICENSE !/.github/ISSUE_TEMPLATE/config.yml !/.github/workflows/auto-approve.yml @@ -6566,6 +8696,8 @@ package-lock.json !/.github/workflows/auto-close-community-prs.yml !/.github/workflows/automerge.yml !/.github/workflows/lock.yml +!/scripts/check-for-upgrades.js +!/.github/workflows/provider-upgrade.yml !/.github/workflows/alert-open-prs.yml !/.github/workflows/force-release.yml !/.github/CODEOWNERS @@ -7505,7 +9637,6 @@ The Maven package is available at [https://mvnrepository.com/artifact/com.hashic \`\`\` - ### Go The go package is generated into the [\`github.com/cdktf/cdktf-provider-random-go\`](https://github.com/cdktf/cdktf-provider-random-go) package. @@ -7723,6 +9854,7 @@ The repository is managed by [CDKTF Repository Manager](https://github.com/cdktf ] }, "cdktf": { + "isDeprecated": false, "provider": { "name": "", "version": "" diff --git a/test/index.test.ts b/test/index.test.ts index 9799d084..7ab68226 100644 --- a/test/index.test.ts +++ b/test/index.test.ts @@ -115,3 +115,39 @@ test("golang release workflow has copyright headers", () => { expect.stringContaining("hashicorp/setup-copywrite") ); }); + +test("has a custom workflow and README if the project is deprecated", () => { + const snapshot = synthSnapshot( + getProject({ isDeprecated: true, deprecationDate: "December 11, 2023" }) + ); + + expect(snapshot).toMatchSnapshot(); + + expect(JSON.parse(snapshot["package.json"])).toHaveProperty( + "cdktf.isDeprecated", + true + ); + + expect(snapshot["README.md"]).toEqual( + expect.stringContaining( + "HashiCorp made the decision to stop publishing new versions of" + ) + ); + + const release = snapshot[".github/workflows/release.yml"]; + expect(release).toEqual( + expect.stringContaining( + "Deprecate the package in package managers if needed" + ) + ); + + const releaseLines = release.split("\n"); + const releaseGoLineIndex = releaseLines.findIndex((line: string) => + line.includes("release_go") + ); + expect(releaseLines.slice(releaseGoLineIndex + 1).join("\n")).toEqual( + expect.stringContaining( + "// Deprecated: HashiCorp is no longer publishing new versions of the prebuilt provider for random." + ) + ); +});