For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to page URLs.
Skip to content
IaCMCdkPlugins

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

Variable
Purpose
Example value

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

PLUGIN_TF_VERSION is shared with Terraform and OpenTofu

PLUGIN_TF_VERSION is the provisioner version variable used by all IaCM provisioners. For CDK workspaces, it controls the CDK CLI version. Setting it on a Terraform or OpenTofu workspace changes the provisioner version for that workspace instead.

CDK behavior variables

Variable
Purpose
Default
Example value

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.y format. Go to AWS CDK releases on npm to find published versions. The plugin installs the CDK CLI at this exact version using npm install aws-cdk@<version>.

  • Language runtime: The version format used by the runtime, such as 3.13 for Python or 20.11.0 for Node.js.

  • Package manager: The versioning scheme of the package manager, such as 10.2.4 for npm or 25.3 for pip.

  • Language and package manager type: A string name, such as python or pip.

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.

Variable
Binary

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

The step fails because the specified version is not available

If the version string in PLUGIN_TF_VERSION or PLUGIN_AWSCDK_LANGUAGE_VERSION does not exist in the upstream registry, the plugin step fails with a download error. Verify the version string against the official release list:

The step fails in a locked-down VPC even though binary paths are set

If the binary is not found at the path specified in PLUGIN_AWSCDK_EXEC_PATH (or the language or package manager equivalent), the plugin falls back to downloading from the upstream registry. In environments without registry access, that fallback fails.

Confirm that the binary version at the specified path exactly matches the version configured in the workspace or the override variable.

A pipeline or stage variable for a version setting is not taking effect

Version variables (PLUGIN_TF_VERSION, PLUGIN_AWSCDK_LANGUAGE, PLUGIN_AWSCDK_LANGUAGE_VERSION, PLUGIN_AWSCDK_PACKAGE_MANAGER, PLUGIN_AWSCDK_PACKAGE_MANAGER_VERSION) follow standard workspace variable precedence. If the same variable is set on the workspace Connectors and Variables tab, the workspace value takes precedence over the pipeline or stage variable.

Check the workspace Connectors and Variables tab and remove the matching variable from the workspace so the pipeline or stage value can take effect.

A pipeline variable for a behavior setting is not taking effect

Behavior variables (PLUGIN_DIFF_VIA_CHANGESET, PLUGIN_DRIFT_VIA_CFN, PLUGIN_DEPLOY_VIA_CFN) follow workspace variable precedence. If the same variable is also set on the workspace Connectors and Variables tab, the workspace value takes precedence over the pipeline or stage variable.

Check the workspace Connectors and Variables tab and remove the matching environment variable from the workspace so the pipeline variable can take effect.


Next steps

Last updated

Was this helpful?