Configure CDK plugin variables
Configure CDK plugin variables to override runtime versions, control diff behavior, and use pre-baked binaries in locked-down environments.
The IaCM CDK plugin reads version and behavior configuration from the workspace UI. You can override that configuration using pipeline or stage variables when the workspace settings do not meet your requirements: for example, when a CDK version is not yet available in the workspace version selector, when you need to control how cdk diff runs, or when your environment cannot download binaries at runtime.
Before you begin
Pipeline permissions: To create or edit a pipeline, your Harness role must include the Pipeline: Create/Edit permission. Contact your account administrator to assign a role that includes this permission.
Compatible versions: Confirm that the CDK CLI version, language runtime version, and package manager version you need are compatible with each other and with your CDK app before setting overrides.
Go to IaCM plugins to review all available plugin environment variables.
Plugin variables
Use the following pipeline or stage variables to override the versions and behavior configured in the workspace UI. Set only the variables you want to override.
CDK CLI, language, and package manager versions
PLUGIN_TF_VERSION
Overrides the CDK CLI version. This variable is shared across all IaCM provisioners.
2.175.0
PLUGIN_AWSCDK_LANGUAGE
Overrides the language runtime.
python
PLUGIN_AWSCDK_LANGUAGE_VERSION
Overrides the language runtime version.
3.13
PLUGIN_AWSCDK_PACKAGE_MANAGER
Overrides the package manager.
pip
PLUGIN_AWSCDK_PACKAGE_MANAGER_VERSION
Overrides the package manager version.
25.3
CDK behavior variables
PLUGIN_DIFF_VIA_CHANGESET
Controls whether cdk diff uses a CloudFormation change set (true) or runs cdk diff directly (false). Direct diff produces human-readable text output without a tabular resource summary.
true
false
PLUGIN_DRIFT_VIA_CFN
Controls whether drift detection uses the CloudFormation drift detection API (true) or a change-set-based comparison (false).
true
false
PLUGIN_DEPLOY_VIA_CFN
Controls whether deployment uses the CloudFormation-based method (true) or the direct CDK deployment method (false).
true
false
CloudFormation-based operations provide additional visibility in the AWS Console, including stack events, rollback behavior, and change set details.
Expected value format
Version strings must match the format used by the tool's official distribution:
CDK CLI:
2.x.yformat. Go to AWS CDK releases on npm to find published versions. The plugin installs the CDK CLI at this exact version usingnpm install aws-cdk@<version>.Language runtime: The version format used by the runtime, such as
3.13for Python or20.11.0for Node.js.Package manager: The versioning scheme of the package manager, such as
10.2.4for npm or25.3for pip.Language and package manager type: A string name, such as
pythonorpip.
Variable precedence
All plugin variables — both version variables and behavior variables — follow standard workspace variable precedence. If the same variable is set both on the workspace Connectors and Variables tab and in the pipeline or stage, the workspace value takes precedence. To use a pipeline or stage override, remove the matching variable from the workspace.
Set a version override
To set a version override, open the pipeline in the Harness pipeline editor. Select the Variables tab to add a pipeline-level variable (applies to all stages), or select the stage and open its Variables section to add a stage-level variable (applies to that stage only).
Pipeline-level override
Stage-level override
Example: Override the CDK CLI version
A workspace is configured with CDK 2.150.0 in the workspace UI, but the CDK app requires 2.175.0. Set the following stage variables:
The workspace UI continues to display 2.150.0. During execution, the plugin installs and uses 2.175.0 for the CDK CLI and 3.13 for Python. Check the CDK step logs at the start of the run to confirm that the plugin is installing the overridden versions.
Use pre-baked binaries
If your CDK app runs in a locked-down VPC where public package registries are not reachable, or you want to avoid downloading binaries at every runtime, you can point the plugin to pre-baked binaries in a custom image or shared volume.
PLUGIN_AWSCDK_EXEC_PATH
CDK CLI
PLUGIN_AWSCDK_LANGUAGE_EXEC_PATH
Language runtime
PLUGIN_AWSCDK_PACKAGE_MANAGER_EXEC_PATH
Package manager
Set each variable to the directory path where the binary is located. The plugin searches for the version specified in the workspace configuration, or the version override variables, at the given path. If the version is found, the plugin uses it without downloading.
Because these paths typically apply to all runs in a workspace, set them on the workspace Connectors and Variables tab rather than in the pipeline:
If you need to override the paths for a specific pipeline run, you can also set them as pipeline or stage variables:
Troubleshooting
Next steps
Go to IaCM plugins to review all available plugin environment variables.
Go to Get started with AWS CDK to configure a CDK workspace.
Go to AWS CDK pipeline steps to configure CDK pipeline steps.
Last updated
Was this helpful?