https://github.com/rssnyder/drone-plugin-cdktf-ts
drone plugin to run cdktf for typescript
https://github.com/rssnyder/drone-plugin-cdktf-ts
Last synced: 12 months ago
JSON representation
drone plugin to run cdktf for typescript
- Host: GitHub
- URL: https://github.com/rssnyder/drone-plugin-cdktf-ts
- Owner: rssnyder
- License: mit
- Created: 2025-05-09T14:42:15.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-05-09T19:05:26.000Z (about 1 year ago)
- Last Synced: 2025-06-10T11:41:29.954Z (about 1 year ago)
- Language: Shell
- Size: 9.77 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# drone-plugin-hcltf
a drone plugin to execute cdktf within a harness pipeline
images are tagged with `node-tofu-cdktf` and you can browse published versions on [dockerhub](https://hub.docker.com/r/harnesscommunity/drone-plugin-cdktf-ts/tags)
## Options
`PLUGIN_CODE_DIR`: directory in your repo where the CDKTF code is located
`PLUGIN_APP`: CDKTF app to synth
`PLUGIN_OUTPUT_DIR` (optional): directory to store resulting TF code
`PLUGIN_NPM_INSTALL_OPTIONS` (optional): additional flags to pass to `npm i` command
`PLUGIN_HCL` (optional): if set, generate output in HCL instead of JSON (default)
## preperation
this plugin uses opentofu, as such to work with cdktf you will need to set the providers in your `cdktf.json` to reference the opentofu registry:
for the aws provider:
```
"terraformProviders": [
"registry.opentofu.org/hashicorp/aws@5.33.0"
],
```
## usage
in an iacm pipeline, this plugin **must** be used before any tofu steps, as they all need the tf code to exist locally:
```
- step:
type: Plugin
name: cdktf
identifier: cdktf
spec:
connectorRef: account.harnessImage
image: harnesscommunity/drone-plugin-cdktf-ts
settings:
CODE_DIR: <+workspace.envVars.CDKTF_DIR>
APP: <+workspace.envVars.CDKTF_APP>
OUTPUT_DIR: /harness/<+workspace.folderPath.split("/stacks")[0]>
```
where you will need to set `CDKTF_DIR` and an environment variable in your workspace to be the relitive location of your CDKTF code in your repo, and `CDKTF_APP` is set to the name of the app you want to synthisize for your pipeline.

the `folderPath` on your workspace should be set and end in `stacks/` to follow the standard output scheme of CDKTF.

## testing
from the location of your cdftf code:
```
rm -rf .gen cdktf.out node_modules;
docker run -v ${PWD}:/harness -e PLUGIN_CODE_DIR=/harness -e PLUGIN_APP=app -it drone-plugin-cdktf-ts
```