CDKTF Local Exec Construct
A simple construct that executes a command locally. This is useful to run build steps within your CDKTF Program or to run a post action after a resource is created.
cdktf-local-exec is in technical preview, which means it's a community supported project. It still requires extensive testing and polishing to mature into a HashiCorp officially supported project. Please file issues generously and detail your experience while using the library. We welcome your feedback.
By using the software in this repository, you acknowledge that:
- cdktf-local-exec is still in development, may change, and has not been released as a commercial product by HashiCorp and is not currently supported in any way by HashiCorp.
- cdktf-local-exec is provided on an "as-is" basis, and may include bugs, errors, or other issues.
- cdktf-local-exec is NOT INTENDED FOR PRODUCTION USE, use of the Software may result in unexpected results, loss of data, or other unexpected results, and HashiCorp disclaims any and all liability resulting from use of cdktf-local-exec.
- HashiCorp reserves all rights to make all decisions about the features, functionality and commercial release (or non-release) of cdktf-local-exec, at any time and without any obligation or liability whatsoever.
Compatibility
cdktf>= 0.21.0constructs>= 10.4.2
How It Works
The construct uses the null provider to achieve this so it can be trusted to only run after all dependencies are met.
Usage
import { Provider, LocalExec } from "cdktf-local-exec";
// LocalExec extends from the null provider,
// so if you already have the provider initialized you can skip this step
new Provider(this, "local-exec");
const frontend = new LocalExec(this, "frontend-build", {
// Will copy this into an asset directory
cwd: "/path/to/project/frontend",
command: "npm install && npm build",
});
const pathToUpload = `${frontend.path}/dist`;
new LocalExec(this, "frontend-upload", {
cwd: pathToUpload,
command: `aws s3 cp --recursive ${pathToUpload} s3://${bucket.name}/frontend`,
});
new LocalExec(this, "backend-build", {
cwd: "/path/to/project/backend",
copyBeforeRun: false, // can not run remotely since the runner has no docker access
command: "docker build -t foo . && docker push foo",
});
Options
cwd: The working directory to run the command in. It will be copied before execution to ensure the asset can be used in a remote execution environment.command: The command to execute.copyBeforeRun: If true, the command will copy thecwddirectory into a tmp dir and run there. If false, the command will be executed in thecwddirectory.
Metadata
Release files for cdktf-local-exec 0.6.28
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cdktf_local_exec-0.6.28.tar.gz | 36.2 kB | Without provenance | Details for cdktf_local_exec-0.6.28.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cdktf_local_exec-0.6.28-py3-none-any.whl | Python 3 | none | any | Details for cdktf_local_exec-0.6.28-py3-none-any.whl |
Total release size: 71.0 kB
Release files / cdktf_local_exec-0.6.28.tar.gz
| Download URL | cdktf_local_exec-0.6.28.tar.gz |
|---|---|
| Size | 36.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2622d9dfdbca7084e923e6499279e80040eea5f02aeb25b51838043ac3d72de7
|
|
BLAKE2b-256 checksum How to use checksums |
471955fac50ce3200d91ac5b89b1fb7a3a4082c521e55a3054b8c87eeee9cd0e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.14.0
|
Release files / cdktf_local_exec-0.6.28-py3-none-any.whl
| Download URL | cdktf_local_exec-0.6.28-py3-none-any.whl |
|---|---|
| Size | 34.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3b0ae417caaea41caa027e30187e373b50a4d4104adba62331ffef9ae2821056
|
|
BLAKE2b-256 checksum How to use checksums |
2379777a1d9c7a6160e2582da79b4da5d40dbcd02a70267aade2f62174471daa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.14.0
|
Security for cdktf-local-exec 0.6.28
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.