{"id":21660058,"url":"https://github.com/hashicorp/terraform-cdk-action","last_synced_at":"2025-07-31T23:30:54.387Z","repository":{"id":37821126,"uuid":"501970620","full_name":"hashicorp/terraform-cdk-action","owner":"hashicorp","description":"The Terraform CDK GitHub Action allows you to run CDKTF as part of your CI/CD workflow","archived":false,"fork":false,"pushed_at":"2024-04-08T12:06:40.000Z","size":9302,"stargazers_count":42,"open_issues_count":4,"forks_count":15,"subscribers_count":11,"default_branch":"main","last_synced_at":"2024-04-09T02:12:33.581Z","etag":null,"topics":["cdk","cdktf","github-actions","terraform"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hashicorp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":".github/SUPPORT.md","governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2022-06-10T08:54:36.000Z","updated_at":"2024-07-31T11:41:10.084Z","dependencies_parsed_at":"2024-01-01T01:21:36.656Z","dependency_job_id":"3444ddae-3238-4a5f-bea6-39da5a9ccac7","html_url":"https://github.com/hashicorp/terraform-cdk-action","commit_stats":{"total_commits":45,"total_committers":10,"mean_commits":4.5,"dds":0.5111111111111111,"last_synced_commit":"0c738cbf486ca1dd98fd074f4307c6baa1ba31ce"},"previous_names":[],"tags_count":126,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hashicorp%2Fterraform-cdk-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hashicorp%2Fterraform-cdk-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hashicorp%2Fterraform-cdk-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hashicorp%2Fterraform-cdk-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hashicorp","download_url":"https://codeload.github.com/hashicorp/terraform-cdk-action/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228312180,"owners_count":17900217,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cdk","cdktf","github-actions","terraform"],"created_at":"2024-11-25T09:32:07.785Z","updated_at":"2025-07-31T23:30:54.378Z","avatar_url":"https://github.com/hashicorp.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# Terraform CDK GitHub Action\n\nThe Terraform CDK GitHub Action allows you to run CDKTF as part of your CI/CD workflow.\n\n\u003c!-- action-docs-inputs action=\"action.yml\" --\u003e\n## Inputs\n\n| name | description | required | default |\n| --- | --- | --- | --- |\n| `cdktfVersion` | \u003cp\u003eThe version of CDKTF to use\u003c/p\u003e | `false` | `0.21.0` |\n| `terraformVersion` | \u003cp\u003eThe version of Terraform to use\u003c/p\u003e | `false` | `1.12.2` |\n| `workingDirectory` | \u003cp\u003eThe directory to use for the project\u003c/p\u003e | `false` | `./` |\n| `mode` | \u003cp\u003eWhat action to take: \u003ccode\u003esynth-only\u003c/code\u003e runs only the synthesis, \u003ccode\u003eplan-only\u003c/code\u003e only runs a plan, \u003ccode\u003eauto-approve-apply\u003c/code\u003e runs a plan and then performs an apply, \u003ccode\u003eauto-approve-destroy\u003c/code\u003e runs a plan and then performs a destroy\u003c/p\u003e | `true` | `\"\"` |\n| `stackName` | \u003cp\u003eThe stack to run / plan, only required when the mode is \u003ccode\u003eplan-only\u003c/code\u003e or \u003ccode\u003eplan-and-apply\u003c/code\u003e\u003c/p\u003e | `false` | `\"\"` |\n| `terraformCloudToken` | \u003cp\u003eThe Terraform Cloud / Terraform Enterprise token to use\u003c/p\u003e | `false` | `\"\"` |\n| `githubToken` | \u003cp\u003eThe github token to use\u003c/p\u003e | `false` | `\"\"` |\n| `commentOnPr` | \u003cp\u003eWhether to comment the plan / the status on the PR\u003c/p\u003e | `false` | `true` |\n| `updateComment` | \u003cp\u003eWhether to update the last comment on the PR rather than adding a new comment\u003c/p\u003e | `false` | `true` |\n| `customNpxArgs` | \u003cp\u003eThe additional CLI arguments to pass to npx as part of the cdktf-cli execution.\u003c/p\u003e | `false` | `\"\"` |\n| `cdktfArgs` | \u003cp\u003eThe additional CLI arguments to pass to cdktf as part of the cdktf-cli execution.\u003c/p\u003e | `false` | `\"\"` |\n| `suppressOutput` | \u003cp\u003eWhether to suppress the output of the action in PR comments\u003c/p\u003e | `false` | `false` |\n\u003c!-- action-docs-inputs action=\"action.yml\" --\u003e\n\n## Example Configurations\n\nThe examples assume you have your provider credentials in Terraform Cloud and you are using remote execution to access the provider credentials or you are passing the provider credentials as environment variables [through the `env` key on the action](https://github.com/Azure/actions-workflow-samples/blob/master/assets/create-secrets-for-GitHub-workflows.md#consume-secrets-in-your-workflow). Please don't use this action with the default `local` backend as the state might get lost and locking might not work.\n\n### Comment the plan of a stack on a PR\n\n```yml\nname: \"Comment a Plan on a PR\"\n\non: [pull_request]\n\npermissions:\n  contents: read\n  pull-requests: write\n\njobs:\n  terraform:\n    name: \"Terraform CDK Diff\"\n    runs-on: ubuntu-latest\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v4\n\n      - uses: actions/setup-node@v4\n        with:\n          node-version: 20\n\n      - use: actions/setup-terraform@v3\n        with:\n          terraform_version: 1.12.2\n\n      - name: Install dependencies\n        run: yarn install\n\n      - name: Generate module and provider bindings\n        run: npx cdktf-cli get\n\n      # Remove this step if you don't have any\n      - name: Run unit tests\n        run: yarn test\n\n      - name: Run Terraform CDK\n        uses: hashicorp/terraform-cdk-action@v10\n        with:\n          cdktfVersion: 0.21.0\n          terraformVersion: 1.12.2\n          mode: plan-only\n          stackName: my-stack\n          terraformCloudToken: ${{ secrets.TF_API_TOKEN }}\n          githubToken: ${{ secrets.GITHUB_TOKEN }}\n```\n\n### Apply a stack after a PR is merged\n\n```yml\nname: \"Apply Stack after PR is Merged\"\n\non:\n  push:\n    branches:\n      - main\n\npermissions:\n  contents: read\n  pull-requests: write\n  issues: read\n\njobs:\n  terraform:\n    name: \"Terraform CDK Deploy\"\n    runs-on: ubuntu-latest\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v4\n\n      - uses: actions/setup-node@v4\n        with:\n          node-version: 20\n\n      - use: actions/setup-terraform@v3\n        with:\n          terraform_version: 1.12.2\n\n      - name: Install dependencies\n        run: yarn install\n\n      - name: Generate module and provider bindings\n        run: npx cdktf-cli get\n\n      # Remove this step if you don't have any\n      - name: Run unit tests\n        run: yarn test\n\n      - name: Run Terraform CDK\n        uses: hashicorp/terraform-cdk-action@v10\n        with:\n          cdktfVersion: 0.21.0\n          terraformVersion: 1.12.2\n          mode: auto-approve-apply\n          stackName: my-stack\n          terraformCloudToken: ${{ secrets.TF_API_TOKEN }}\n          githubToken: ${{ secrets.GITHUB_TOKEN }}\n```\n\n### Synthesize on PRs\n\n```yml\nname: \"Synth the CDKTF Application on PRs\"\n\non: [pull_request]\n\npermissions:\n  contents: read\n  pull-requests: write\n\njobs:\n  terraform:\n    name: \"Terraform CDK Synth\"\n    runs-on: ubuntu-latest\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v4\n\n      - uses: actions/setup-node@v4\n        with:\n          node-version: 20\n\n      - use: actions/setup-terraform@v3\n        with:\n          terraform_version: 1.12.2\n\n      - name: Install dependencies\n        run: yarn install\n\n      - name: Generate module and provider bindings\n        run: npx cdktf-cli get\n\n      # Remove this step if you don't have any\n      - name: Run unit tests\n        run: yarn test\n\n      - name: Test the synth\n        uses: hashicorp/terraform-cdk-action@v10\n        with:\n          cdktfVersion: 0.21.0\n          terraformVersion: 1.12.2\n          mode: synth-only\n          stackName: my-stack\n```\n\n## Limitations\n\nThis action is intended to be limited to a single stack. While you could pass `*` as the stack name and use multi-stack deployments, we don't currently support all the complexities of doing accurate plans across multiple dependent workspaces within the action.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhashicorp%2Fterraform-cdk-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhashicorp%2Fterraform-cdk-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhashicorp%2Fterraform-cdk-action/lists"}