From cdc22ba821f1ddeb138a1f31e6a94d32f7e262e8 Mon Sep 17 00:00:00 2001 From: Daniel Schmidt Date: Wed, 24 Jan 2024 11:57:48 +0100 Subject: [PATCH] fix: find step by id instead of index (#399) --- .projen/deps.json | 2 +- .projenrc.ts | 2 +- package.json | 4 +- src/index.ts | 15 +- test/__snapshots__/index.test.ts.snap | 2723 +++++++++++++++++++++++++ test/index.test.ts | 18 + yarn.lock | 8 +- 7 files changed, 2757 insertions(+), 15 deletions(-) diff --git a/.projen/deps.json b/.projen/deps.json index 1c9e492c..d184ff6d 100644 --- a/.projen/deps.json +++ b/.projen/deps.json @@ -125,7 +125,7 @@ }, { "name": "projen", - "version": "^0.79.2", + "version": "^0.79.3", "type": "peer" }, { diff --git a/.projenrc.ts b/.projenrc.ts index 681f53e8..6ce76727 100644 --- a/.projenrc.ts +++ b/.projenrc.ts @@ -33,7 +33,7 @@ const project = new cdk.JsiiProject({ pullRequestTemplate: false, jsiiVersion: "~5.2.0", typescriptVersion: "~5.2.0", // should always be the same major/minor as JSII - peerDeps: ["projen@^0.79.2", "constructs@^10.3.0"], + peerDeps: ["projen@^0.79.3", "constructs@^10.3.0"], deps: ["change-case", "fs-extra"], devDeps: ["@types/fs-extra", "glob"], bundledDeps: ["change-case", "fs-extra"], diff --git a/package.json b/package.json index 6924c437..f3e1e3d1 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,7 @@ "jsii-pacmak": "^1.94.0", "jsii-rosetta": "~5.2.0", "prettier": "^2.8.8", - "projen": "0.79.2", + "projen": "0.79.3", "standard-version": "^9", "ts-jest": "^29", "ts-node": "^10.9.2", @@ -63,7 +63,7 @@ }, "peerDependencies": { "constructs": "^10.3.0", - "projen": "^0.79.2" + "projen": "^0.79.3" }, "dependencies": { "change-case": "^4.1.2", diff --git a/src/index.ts b/src/index.ts index 68d67baa..b3ab4d51 100644 --- a/src/index.ts +++ b/src/index.ts @@ -338,17 +338,18 @@ export class CdktfProviderProject extends cdk.JsiiProject { ); // ensure we don't fail if the release file is not present - // exit 0 if ./dist/dist/releasetag.txt is not present, otherwise exit 1 - const oldRun: string = (this.release as any).defaultBranch.workflow.jobs - .release.steps[5].run; + const checkExistingTagStep = ( + this.release as any + ).defaultBranch.workflow.jobs.release.steps.find( + (s: object) => "id" in s && s.id === "check_tag_exists" + ); + const oldExistingTagRun: string = checkExistingTagStep.run; prettyAssertEqual( - oldRun.split("\n")[0], + oldExistingTagRun.split("\n")[0], "TAG=$(cat dist/dist/releasetag.txt)", "release step changed, please check if the workaround still works!" ); - ( - this.release as any - ).defaultBranch.workflow.jobs.release.steps[5].run = `if [ ! -f dist/dist/releasetag.txt ]; then (echo "exists=true" >> $GITHUB_OUTPUT) && exit 0; fi\n${oldRun}`; + checkExistingTagStep.run = `if [ ! -f dist/dist/releasetag.txt ]; then (echo "exists=true" >> $GITHUB_OUTPUT) && exit 0; fi\n${oldExistingTagRun}`; if (!isDeprecated) { const { upgrade, pr } = (this.upgradeWorkflow as any).workflows[0].jobs; diff --git a/test/__snapshots__/index.test.ts.snap b/test/__snapshots__/index.test.ts.snap index e4d9df3f..566ef4d1 100644 --- a/test/__snapshots__/index.test.ts.snap +++ b/test/__snapshots__/index.test.ts.snap @@ -10262,3 +10262,2726 @@ const execSync = require("child_process").execSync; ", } `; + +exports[`with minNodeVersion 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/dependabot.yml linguist-generated +/.github/ISSUE_TEMPLATE/config.yml linguist-generated +/.github/workflows/alert-open-prs.yml 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/force-release.yml linguist-generated +/.github/workflows/lock.yml linguist-generated +/.github/workflows/provider-upgrade.yml linguist-generated +/.github/workflows/pull-request-lint.yml linguist-generated +/.github/workflows/release.yml linguist-generated +/.github/workflows/stale.yml linguist-generated +/.github/workflows/upgrade-main.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 +/scripts/check-for-upgrades.js linguist-generated +/scripts/should-release.js 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=\`acme\`+provider:+" + about: Please file issues with pre-built providers in our main repository. +", + ".github/dependabot.yml": "# NOTE: Dependabot configuration is not managed by Projen because if you enable Dependabot through Projen, +# it will delete the upgrade-main job and expect you to only use Dependabot for updates. +# That is not what we want either; we just want to use Dependabot for security updates. + +version: 2 +updates: + - package-ecosystem: npm + versioning-strategy: lockfile-only + directory: / + schedule: + interval: daily + ignore: + - dependency-name: projen + labels: + - auto-approve + - automerge + - dependencies + - security + # Disable version updates for npm dependencies, only use Dependabot for security updates + open-pull-requests-limit: 0 +", + ".github/workflows/alert-open-prs.yml": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +name: alert-open-prs +on: + workflow_dispatch: {} + schedule: + - cron: "* */12 * * 1-5" +jobs: + check-open-prs: + runs-on: ubuntu-latest + permissions: + pull-requests: read + env: {} + steps: + - name: Find old PRs + id: old_prs + env: + GH_TOKEN: \${{ github.token }} + run: |- + PR_LINKS=$(gh pr list --state open --repo="cdktf/cdktf-provider-acme" --search "created:<$(date -d '-2hours' +%FT%TZ)" --json url --jq "map(.url)" ) + if [ "$PR_LINKS" == "[]" ]; then + echo "No PRs open for more than 2 hour(s)" + else + echo "pr_links=$PR_LINKS" >> $GITHUB_OUTPUT + fi + - name: Alert Slack on old PRs + if: \${{ steps.old_prs.outputs.pr_links }} + uses: slackapi/slack-github-action@e28cf165c92ffef168d23c5c9000cffc8a25e117 + env: + SLACK_WEBHOOK_URL: \${{ secrets.ALERT_PRS_SLACK_WEBHOOK_URL }} + with: + payload: "{\\"pr_links\\":\\"\${{ join(fromJSON(steps.old_prs.outputs.pr_links), ', ') }}\\"}" +", + ".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-acme). 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-acme). 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: Setup Node.js + uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 + with: + node-version: 18.12.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.12.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 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.12.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 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.12.0 + - 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.12.0 + - 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.12.0 + - 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/force-release.yml": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +name: force-release +on: + workflow_dispatch: + inputs: + sha: + name: sha + type: string + required: true + description: The sha of the commit to release + publish_to_go: + name: publish_to_go + type: boolean + required: true + description: Whether to publish to Go Repository +jobs: + force-release: + runs-on: ubuntu-latest + permissions: + contents: write + env: + CI: "true" + steps: + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + with: + ref: \${{ inputs.sha }} + 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: Setup Node.js + uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 + with: + node-version: 18.12.0 + - name: Install dependencies + run: yarn install --check-files --frozen-lockfile + - name: build + run: npx projen build + - 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 + force_release_golang: + name: Publish to Github Go Repository + needs: force-release + runs-on: ubuntu-latest + permissions: + contents: read + env: + CI: "true" + steps: + - name: Setup Node.js + uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 + with: + node-version: 18.12.0 + - name: Setup Go + 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 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/## Go 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-acme/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 + - name: Copy the README file to the parent directory + run: cp .repo/dist/go/*/README.md .repo/dist/go/README.md + - name: Collect go Artifact + run: mv .repo/dist dist + - name: Release + if: \${{ inputs.publish_to_go }} + 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 +", + ".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/provider-upgrade.yml": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +name: provider-upgrade +on: + schedule: + - cron: 0 3 * * * + workflow_dispatch: {} +jobs: + upgrade: + runs-on: ubuntu-latest + permissions: + pull-requests: write + issues: write + contents: write + statuses: write + env: + NODE_OPTIONS: --max-old-space-size=6656 + steps: + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + - run: yarn install + - id: check_version + run: yarn check-if-new-provider-version + - name: get provider current version + id: current_version + if: \${{ steps.check_version.outputs.new_version == 'available' }} + run: echo "value=$(jq -r '.cdktf.provider.version' package.json)" >> $GITHUB_OUTPUT + - if: \${{ steps.check_version.outputs.new_version == 'available' }} + env: + CHECKPOINT_DISABLE: "1" + GH_TOKEN: \${{ secrets.GITHUB_TOKEN }} + run: yarn fetch + - name: get provider updated version + id: new_version + if: \${{ steps.check_version.outputs.new_version == 'available' }} + run: echo "value=$(jq -r '. | to_entries[] | .value' src/version.json)" >> $GITHUB_OUTPUT + - name: Determine if this is a minor or patch release + id: release + if: \${{ steps.check_version.outputs.new_version == 'available' }} + env: + CURRENT_VERSION: \${{ steps.current_version.outputs.value }} + NEW_VERSION: \${{ steps.new_version.outputs.value }} + run: |- + CURRENT_VERSION_MINOR=$(cut -d "." -f 2 <<< "$CURRENT_VERSION") + NEW_VERSION_MINOR=$(cut -d "." -f 2 <<< "$NEW_VERSION") + [[ "$CURRENT_VERSION_MINOR" != "$NEW_VERSION_MINOR" ]] && IS_MINOR_RELEASE=true || IS_MINOR_RELEASE=false + [[ "$IS_MINOR_RELEASE" == "true" ]] && SEMANTIC_TYPE=feat || SEMANTIC_TYPE=fix + echo "is_minor=$IS_MINOR_RELEASE" >> $GITHUB_OUTPUT + echo "type=$SEMANTIC_TYPE" >> $GITHUB_OUTPUT + - if: \${{ steps.check_version.outputs.new_version == 'available' }} + run: yarn compile + - if: \${{ steps.check_version.outputs.new_version == 'available' }} + run: yarn docgen + - name: Create Pull Request + if: \${{ steps.check_version.outputs.new_version == 'available' }} + uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38 + with: + branch: auto/provider-upgrade + commit-message: "\${{ steps.release.outputs.type }}: upgrade provider from \`\${{ steps.current_version.outputs.value }}\` to version \`\${{ steps.new_version.outputs.value }}\`" + title: "\${{ steps.release.outputs.type }}: upgrade provider from \`\${{ steps.current_version.outputs.value }}\` to version \`\${{ steps.new_version.outputs.value }}\`" + body: This PR upgrades the underlying Terraform provider to version \${{ steps.new_version.outputs.value }} + labels: automerge,auto-approve + token: \${{ secrets.GH_TOKEN }} + delete-branch: true + committer: team-tf-cdk + author: Team Terraform CDK + signoff: true +", + ".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 }} + tag_exists: \${{ steps.check_tag_exists.outputs.exists }} + 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: Setup Node.js + uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 + with: + node-version: 18.12.0 + - name: Install dependencies + run: yarn install --check-files --frozen-lockfile + - name: release + run: npx projen release + - name: Check if version has already been tagged + id: check_tag_exists + run: |- + if [ ! -f dist/dist/releasetag.txt ]; then (echo "exists=true" >> $GITHUB_OUTPUT) && exit 0; fi + TAG=$(cat dist/dist/releasetag.txt) + ([ ! -z "$TAG" ] && git ls-remote -q --exit-code --tags origin $TAG && (echo "exists=true" >> $GITHUB_OUTPUT)) || (echo "exists=false" >> $GITHUB_OUTPUT) + cat $GITHUB_OUTPUT + - name: Check for new commits or cancel via faking a SHA if release was cancelled + id: git_remote + run: node ./scripts/should-release.js && (echo "latest_commit=$(git ls-remote origin -h \${{ github.ref }} | cut -f1)" >> $GITHUB_OUTPUT && cat $GITHUB_OUTPUT) || echo "latest_commit=release_cancelled" >> $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=$(cat package.json | jq .cdktf.isDeprecated -r) + 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 == 'true' || steps.check_status.outputs.is_deprecated == true + env: + NPM_REGISTRY: registry.npmjs.org + NPM_TOKEN: \${{ secrets.NPM_TOKEN }} + run: |- + npm set "//$NPM_REGISTRY/:_authToken=$NPM_TOKEN" + npm deprecate @cdktf/provider-acme "See https://cdk.tf/imports for details on how to continue to use the acme 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.tag_exists != 'true' && needs.release.outputs.latest_commit == github.sha + steps: + - uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 + with: + node-version: 18.12.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: 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.tag_exists != 'true' && needs.release.outputs.latest_commit == github.sha + steps: + - uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 + with: + node-version: 18.12.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 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.tag_exists != 'true' && 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.12.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 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.tag_exists != 'true' && needs.release.outputs.latest_commit == github.sha + steps: + - uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 + with: + node-version: 18.12.0 + - 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.tag_exists != 'true' && needs.release.outputs.latest_commit == github.sha + steps: + - uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 + with: + node-version: 18.12.0 + - 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.tag_exists != 'true' && needs.release.outputs.latest_commit == github.sha + steps: + - uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 + with: + node-version: 18.12.0 + - 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/## Go 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-acme/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 + - name: Copy the README file to the parent directory + run: cp .repo/dist/go/*/README.md .repo/dist/go/README.md + - 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@28ca1036281a5e5922ead5184a1bbf96e5fc984e + 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 +", + ".github/workflows/upgrade-main.yml": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +name: upgrade-main +on: + workflow_dispatch: {} + schedule: + - cron: 0 0 * * 1 +jobs: + upgrade: + name: Upgrade + runs-on: ubuntu-latest + permissions: + contents: read + outputs: + patch_created: \${{ steps.create_patch.outputs.patch_created }} + steps: + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + with: + ref: main + - name: Set git config safe.directory + run: git config --global --add safe.directory $(pwd) + - name: Setup Node.js + uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 + with: + node-version: 18.12.0 + - name: Install dependencies + run: yarn install --check-files --frozen-lockfile + - name: Upgrade dependencies + run: npx projen upgrade + - name: Find mutations + id: create_patch + run: |- + git add . + git diff --staged --patch --exit-code > .repo.patch || echo "patch_created=true" >> $GITHUB_OUTPUT + - name: Upload patch + if: steps.create_patch.outputs.patch_created + uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 + with: + name: .repo.patch + path: .repo.patch + pr: + name: Create Pull Request + needs: upgrade + runs-on: ubuntu-latest + permissions: + contents: read + if: \${{ needs.upgrade.outputs.patch_created }} + steps: + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + with: + ref: main + - name: Set git config safe.directory + run: git config --global --add safe.directory $(pwd) + - 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: Create Pull Request + id: create-pr + uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38 + with: + token: \${{ secrets.PROJEN_GITHUB_TOKEN }} + commit-message: |- + chore(deps): upgrade dependencies + + Upgrades project dependencies. See details in [workflow run]. + + [Workflow Run]: \${{ github.server_url }}/\${{ github.repository }}/actions/runs/\${{ github.run_id }} + + ------ + + *Automatically created by projen via the "upgrade-main" workflow* + branch: github-actions/upgrade-main + title: "chore(deps): upgrade dependencies" + labels: automerge,auto-approve,dependencies + body: |- + Upgrades project dependencies. See details in [workflow run]. + + [Workflow Run]: \${{ github.server_url }}/\${{ github.repository }}/actions/runs/\${{ github.run_id }} + + ------ + + *Automatically created by projen via the "upgrade-main" workflow* + author: team-tf-cdk + committer: team-tf-cdk + signoff: true +", + ".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 +!/.github/workflows/build.yml +/dist/changelog.md +/dist/version.txt +!/.github/workflows/release.yml +!/.github/workflows/upgrade-main.yml +!/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 +!/scripts/check-for-upgrades.js +!/.github/workflows/provider-upgrade.yml +!/.github/workflows/alert-open-prs.yml +!/.github/workflows/force-release.yml +!/.github/dependabot.yml +!/.github/CODEOWNERS +!/scripts/should-release.js +API.md +!/docs/*.md +!/.copywrite.hcl +!/.projenrc.js +", + ".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 +/.gitattributes +", + ".projen/deps.json": "{ + "dependencies": [ + { + "name": "@actions/core", + "version": "^1.1.0", + "type": "build" + }, + { + "name": "@cdktf/provider-project", + "version": "^0.5.0", + "type": "build" + }, + { + "name": "@types/node", + "version": "^18", + "type": "build" + }, + { + "name": "cdktf-cli", + "version": "^0.20.0", + "type": "build" + }, + { + "name": "cdktf", + "version": "^0.20.0", + "type": "build" + }, + { + "name": "constructs", + "version": "^10.3.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": "~5.3.0", + "type": "build" + }, + { + "name": "projen", + "type": "build" + }, + { + "name": "semver", + "version": "^7.5.3", + "type": "build" + }, + { + "name": "standard-version", + "version": "^9", + "type": "build" + }, + { + "name": "typescript", + "version": "~5.3.0", + "type": "build" + }, + { + "name": "@types/yargs", + "version": "17.0.13", + "type": "override" + }, + { + "name": "cdktf", + "version": "^0.20.0", + "type": "peer" + }, + { + "name": "constructs", + "version": "^10.3.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/dependabot.yml", + ".github/ISSUE_TEMPLATE/config.yml", + ".github/workflows/alert-open-prs.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/build.yml", + ".github/workflows/force-release.yml", + ".github/workflows/lock.yml", + ".github/workflows/provider-upgrade.yml", + ".github/workflows/pull-request-lint.yml", + ".github/workflows/release.yml", + ".github/workflows/stale.yml", + ".github/workflows/upgrade-main.yml", + ".gitignore", + ".projen/deps.json", + ".projen/files.json", + ".projen/tasks.json", + "cdktf.json", + "LICENSE", + "README.md", + "scripts/check-for-upgrades.js", + "scripts/should-release.js", + "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):\\"" + }, + "check-if-new-provider-version": { + "name": "check-if-new-provider-version", + "steps": [ + { + "exec": "node ./scripts/check-for-upgrades.js" + } + ] + }, + "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/acme/* ./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" + } + ] + }, + "post-upgrade": { + "name": "post-upgrade", + "description": "Runs after upgrading dependencies" + }, + "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" + } + ], + "condition": "node ./scripts/should-release.js" + }, + "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" + } + ] + }, + "upgrade": { + "name": "upgrade", + "description": "upgrade dependencies", + "env": { + "CI": "0" + }, + "steps": [ + { + "exec": "npx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@actions/core,@cdktf/provider-project,@types/node,cdktf-cli,cdktf,constructs,dot-prop,jsii-diff,jsii-docgen,jsii-pacmak,projen,semver,standard-version" + }, + { + "exec": "yarn install --check-files" + }, + { + "exec": "yarn upgrade @actions/core @cdktf/provider-project @types/node cdktf-cli cdktf constructs dot-prop jsii-diff jsii-docgen jsii-pacmak projen semver standard-version" + }, + { + "exec": "npx projen" + }, + { + "spawn": "post-upgrade" + } + ] + }, + "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) 2024 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 vancluever/acme provider version ~> 2.10 + +This repo builds and publishes the [Terraform acme provider](https://registry.terraform.io/providers/vancluever/acme/2.10.0/docs) bindings for [CDK for Terraform](https://cdk.tf). + +## Available Packages + +### NPM + +The npm package is available at [https://www.npmjs.com/package/@cdktf/provider-acme](https://www.npmjs.com/package/@cdktf/provider-acme). + +\`npm install @cdktf/provider-acme\` + +### PyPI + +The PyPI package is available at [https://pypi.org/project/cdktf-cdktf-provider-acme](https://pypi.org/project/cdktf-cdktf-provider-acme). + +\`pipenv install cdktf-cdktf-provider-acme\` + +### Nuget + +The Nuget package is available at [https://www.nuget.org/packages/HashiCorp.Cdktf.Providers.Acme](https://www.nuget.org/packages/HashiCorp.Cdktf.Providers.Acme). + +\`dotnet add package HashiCorp.Cdktf.Providers.Acme\` + +### Maven + +The Maven package is available at [https://mvnrepository.com/artifact/com.hashicorp/cdktf-provider-acme](https://mvnrepository.com/artifact/com.hashicorp/cdktf-provider-acme). + +\`\`\` + + com.hashicorp + cdktf-provider-acme + [REPLACE WITH DESIRED VERSION] + +\`\`\` + +### Go + +The go package is generated into the [\`github.com/cdktf/cdktf-provider-acme-go\`](https://github.com/cdktf/cdktf-provider-acme-go) package. + +\`go get github.com/cdktf/cdktf-provider-acme-go/acme/\` + +Where \`\` is the version of the prebuilt provider you would like to use e.g. \`v11\`. The full module name can be found +within the [go.mod](https://github.com/cdktf/cdktf-provider-acme-go/blob/main/acme/go.mod#L1) file. + +## 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-acme). + +## Versioning + +This project is explicitly not tracking the Terraform acme provider version 1:1. In fact, it always tracks \`latest\` of \`~> 2.10\` 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). + +These are the upstream dependencies: + +- [CDK for Terraform](https://cdk.tf) +- [Terraform acme provider](https://registry.terraform.io/providers/vancluever/acme/2.10.0) +- [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. + +## Features / Issues / Bugs + +Please report bugs and issues to the [CDK for Terraform](https://cdk.tf) project: + +- [Create bug report](https://cdk.tf/bug) +- [Create feature request](https://cdk.tf/feature) + +## Contributing + +### Projen + +This is mostly based on [Projen](https://github.com/projen/projen), which takes care of generating the entire repository. + +### cdktf-provider-project based on Projen + +There's a custom [project builder](https://github.com/cdktf/cdktf-provider-project) which encapsulate the common settings for all \`cdktf\` prebuilt providers. + +### Provider Version + +The provider version can be adjusted in [./.projenrc.js](./.projenrc.js). + +### Repository Management + +The repository is managed by [CDKTF Repository Manager](https://github.com/cdktf/cdktf-repository-manager/). +", + "cdktf.json": "{ + "language": "typescript", + "app": "echo noop", + "sendCrashReports": false, + "terraformProviders": [ + "vancluever/acme@~> 2.10" + ], + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run \\"npx projen\\"." +} +", + "package.json": "{ + "name": "@cdktf/provider-acme", + "description": "Prebuilt acme Provider for Terraform CDK (cdktf)", + "repository": { + "type": "git", + "url": "https://github.com/cdktf/cdktf-provider-acme.git" + }, + "scripts": { + "build": "npx projen build", + "bump": "npx projen bump", + "check-if-new-provider-version": "npx projen check-if-new-provider-version", + "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", + "post-upgrade": "npx projen post-upgrade", + "pre-compile": "npx projen pre-compile", + "release": "npx projen release", + "test": "jest --passWithNoTests", + "unbump": "npx projen unbump", + "unconditional-bump": "npx projen unconditional-bump", + "upgrade": "npx projen upgrade", + "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.5.0", + "@types/node": "^18", + "cdktf": "^0.20.0", + "cdktf-cli": "^0.20.0", + "constructs": "^10.3.0", + "dot-prop": "^5.2.0", + "jsii": "~5.3.0", + "jsii-diff": "*", + "jsii-docgen": "^10.2.3", + "jsii-pacmak": "*", + "jsii-rosetta": "~5.2.0", + "projen": "*", + "semver": "^7.5.3", + "standard-version": "^9", + "typescript": "~5.3.0" + }, + "peerDependencies": { + "cdktf": "^0.20.0", + "constructs": "^10.3.0" + }, + "resolutions": { + "@types/yargs": "17.0.13" + }, + "keywords": [ + "acme", + "cdk", + "cdktf", + "provider", + "terraform" + ], + "engines": { + "node": ">= 18.12.0" + }, + "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.acme", + "maven": { + "groupId": "com.hashicorp", + "artifactId": "cdktf-provider-acme" + } + }, + "python": { + "distName": "cdktf-cdktf-provider-acme", + "module": "cdktf_cdktf_provider_acme" + }, + "dotnet": { + "namespace": "HashiCorp.Cdktf.Providers.Acme", + "packageId": "HashiCorp.Cdktf.Providers.Acme" + }, + "go": { + "moduleName": "github.com/cdktf/cdktf-provider-acme-go", + "packageName": "acme" + } + }, + "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": false, + "provider": { + "name": "", + "version": "" + } + }, + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run \\"npx projen\\"." +} +", + "scripts/check-for-upgrades.js": " +/** + * Copyright (c) HashiCorp, Inc. + * SPDX-License-Identifier: MPL-2.0 + */ +const semver = require("semver"); +const actions = require("@actions/core"); + +// Code is inlined below, as this import requires us to add all dev dependencies of cdktf-cli as we're not +// using the bundle. A better alternative would be to refactor this method to move to its own package, that +// the cdktf-cli and others can use (we have the same "problem" with some other code in cdktf, cdktf-cli and +// the @cdktf/provider-generator package, too) +// const { versionMatchesConstraint } = require('cdktf-cli/lib/dependencies/version-constraints'); + +// set by the projen file that generates this script +const CONSTRAINT = "~> 2.10"; +const FQ_PROVIDER_NAME = "vancluever/acme"; + +(async function main() { + if (await newerMatchingProviderVersionExists()) { + console.log( + \`Found newer Terraform provider version matching the current constraint: \${CONSTRAINT}\` + ); + setGithubStepOutput("new_version", "available"); + } else { + console.log("No changes detected."); + setGithubStepOutput("new_version", "unavailable"); + } +})(); + +function setGithubStepOutput(name, value) { + actions.setOutput(name, value); +} + +async function newerMatchingProviderVersionExists() { + const res = await fetch( + \`https://registry.terraform.io/v2/providers/\${FQ_PROVIDER_NAME}/provider-versions\` + ); + const body = await res.json(); + + const currentVersion = await getCurrentProviderVersion(); + + const availableVersions = body.data.map((it) => it.attributes.version); + const versionsMatching = availableVersions.filter((v) => + versionMatchesConstraint(v, CONSTRAINT) + ); + if (versionsMatching.length <= 0) { + throw new Error( + \`Unexpected Error: Found no matching versions for constraint \${CONSTRAINT} in [\${availableVersions.join( + ", " + )}]\` + ); + } + + const versionsGreaterThanCurrent = versionsMatching.filter((v) => + semver.gt(v, currentVersion) + ); + if (versionsGreaterThanCurrent.length > 0) { + console.log( + \`One or more matching versions (\${CONSTRAINT}) are greater than the current version (\${currentVersion}): [\${versionsGreaterThanCurrent.join( + ", " + )}]\` + ); + return true; + } else { + console.log( + \`Found no matching versions (\${CONSTRAINT}) greater than the current version (\${currentVersion}). Matching versions: [\${versionsMatching.join( + ", " + )}]\` + ); + } + return false; +} + +// e.g. cdktf 0.12.x -> 0.13.x but not 0.12.y -> 0.12.z +async function cdktfVersionMajorChanged() { + throw new Error("todo implement"); +} + +async function getCurrentProviderVersion() { + const json = require("../src/version.json"); + return json[\`registry.terraform.io/\${FQ_PROVIDER_NAME.toLowerCase()}\`]; +} + +// SEE NOTICE AT THE TOP WHY THIS IS INLINED CURRENTLY +// copied from https://github.com/hashicorp/terraform-cdk/blob/df858ccf4ac71a168e3636f053c6743324c98332/packages/%40cdktf/cli-core/src/lib/dependencies/version-constraints.ts +// and converted to JavaScript + +// constraints can be prefixed with "~>", ">", "<", "=", ">=", "<=" or "!=" +// no prefix means "=" +function parseConstraint(constraint) { + const cleaned = constraint.trim(); + + const operator = cleaned.match(/(~>|>=|<=|>|<|=|!=)/)?.[0] || "="; + const version = cleaned.replace(operator, "").trim(); + + return { + operator, + version, + }; +} + +function versionMatchesConstraint(version, constraint) { + // https://www.terraform.io/language/expressions/version-constraints + // version can contain multiple constraints split by "," + + const constraints = constraint.split(","); + version = semver.coerce(version)?.version ?? version; + + // each constraint needs to be satisfied + return constraints.every((c) => { + const parsed = parseConstraint(c); + + const cleanedParsedVersion = + semver.coerce(parsed.version)?.version ?? parsed.version; + + switch (parsed.operator) { + case "=": + return version === cleanedParsedVersion; + case "!=": + return version !== cleanedParsedVersion; + case "~>": { + // allows rightmost version component to increment + + const parts = parsed.version.split("."); + const minorSpecified = parts.length === 2; + const majorIsZero = parts[0] === "0"; + + // ~>2.0 which allows 2.1 and 2.1.1 needs special handling as + // npm semver handles "~" differently for ~2.0 than for ~2 or ~2.1.0 + // So we need to use "^" (e.g. ^2.0) for this case + // see: https://github.com/npm/node-semver/issues/11 + const allowMinorAndPatchOnly = minorSpecified; + + let range = allowMinorAndPatchOnly + ? \`^\${parsed.version}\` + : \`~\${parsed.version}\`; + + // versions below 1.0 are treated a bit differently in NPM than in Terraform + // meaning that NPMs ^0.4 doesn't allow 0.55 while TFs ~>0.4 allows 0.55 + if (majorIsZero && minorSpecified) { + range = \`>=\${parsed.version} <1.0.0\`; + } + + return semver.satisfies(version, range); + } + case ">=": + return semver.gte(version, cleanedParsedVersion); + case "<=": + return semver.lte(version, cleanedParsedVersion); + case ">": + return semver.gt(version, cleanedParsedVersion); + case "<": + return semver.lt(version, cleanedParsedVersion); + default: + throw Errors.External( + \`Unknown constraint operator: \${parsed.operator} in version constraint \${constraint}\` + ); + } + }); +} +", + "scripts/should-release.js": " +/** + * Copyright (c) HashiCorp, Inc. + * SPDX-License-Identifier: MPL-2.0 + */ +// Note: This script is currently not handling pre-releases +const execSync = require("child_process").execSync; + +(async function main() { + console.log( + "Determining whether changes warrant a new release. Non-zero exit code indicates that a release should be skipped" + ); + + // inspired by https://github.com/projen/projen/blob/08378c40d1453288053abcddce82475329b4506e/src/release/bump-version.ts#L281 + const prefixFilter = \`v*\`; + const listGitTags = [ + "git", + '-c "versionsort.suffix=-"', // makes sure pre-release versions are listed after the primary version + "tag", + '--sort="-version:refname"', // sort as versions and not lexicographically + "--list", + \`"\${prefixFilter}"\`, + ].join(" "); + + const stdout = execSync(listGitTags).toString(); + const tags = stdout.split("\\n"); + + if (tags.length > 0 && tags[0].trim() !== "") { + const latestTag = tags[0]; + console.log(\`Found latest tag \${latestTag}\`); + + const previousPackageJsonGit = [ + "git", + "show", + \`\${latestTag}:package.json\`, + ].join(" "); + const prevPackageJson = JSON.parse( + execSync(previousPackageJsonGit).toString() + ); + const currPackageJson = require("../package.json"); + + const thingsToDiff = [ + { + name: "Terraform provider version", + previous: prevPackageJson.cdktf.provider.version, + current: currPackageJson.cdktf.provider.version, + }, + { + name: "cdktf peer dependency", + previous: prevPackageJson.peerDependencies.cdktf, + current: currPackageJson.peerDependencies.cdktf, + }, + ]; + + thingsToDiff.forEach((x) => + console.log( + \`\${x.name}: \${x.previous} => \${x.current} \${ + x.current !== x.previous ? "< x.previous !== x.current); + if (changes) { + console.log( + "Found one or more relevant changes, not skipping the release." + ); + } else { + console.log( + "No changes in versions detected, skipping the release via exit code 1" + ); + process.exit(1); + } + } else { + console.log( + "No git tags found, this seems to be the first release, hence not skipping it." + ); + } +})();", + "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": [ + "src/**/*.ts", + "test/**/*.ts", + ".projenrc.js" + ], + "exclude": [ + "node_modules" + ] +} +", +} +`; diff --git a/test/index.test.ts b/test/index.test.ts index 45a287f1..a7b4c193 100644 --- a/test/index.test.ts +++ b/test/index.test.ts @@ -187,3 +187,21 @@ test("override maven group id", () => { "dev.gofer.cdktf.providers.random_provider" ); }); + +test("with minNodeVersion", () => { + const snapshot = synthSnapshot( + new CdktfProviderProject({ + useCustomGithubRunner: false, + terraformProvider: "vancluever/acme@~> 2.10", + cdktfVersion: "^0.20.0", + constructsVersion: "^10.3.0", + minNodeVersion: "18.12.0", + jsiiVersion: "~5.3.0", + typescriptVersion: "~5.3.0", // NOTE: this should be the same major/minor version as JSII + devDeps: ["@cdktf/provider-project@^0.5.0"], + isDeprecated: false, + } as any) + ); + + expect(snapshot).toMatchSnapshot(); +}); diff --git a/yarn.lock b/yarn.lock index e5adaf95..b41613ba 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4122,10 +4122,10 @@ process-nextick-args@~2.0.0: resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag== -projen@0.79.2: - version "0.79.2" - resolved "https://registry.yarnpkg.com/projen/-/projen-0.79.2.tgz#ac1d51a07ad3fcb503ca712055b430042ccab853" - integrity sha512-ZKO2GDsJyU+MfsQAcvpMKPrWcuS2rPPCpqf2biZ7rcBVdYnDiOn03G1Gm9G/wRereMdDTciL6DYqsxTF4UvfqA== +projen@0.79.3: + version "0.79.3" + resolved "https://registry.yarnpkg.com/projen/-/projen-0.79.3.tgz#385761af74b8df15f58eef21022eb7d3645b2690" + integrity sha512-nmYW1YXFNdZNNDlfHsT4sMfE5vMgMbpG061RT+gtuvGkhm+6nYd8+kWo6xk+2J/egoNvXyS5kEbh4fFc41I5hA== dependencies: "@iarna/toml" "^2.2.5" case "^1.6.3"