aws / aws/aws-cdk-cli

(cli): CDK_METHOD env var colision

Open
#1,906 1 comment 0 reactions 0 assignees View on GitHub
aws-cdk bug p2
Dominant language
TypeScript
Stars
105
Forks
122
Avg merge
1d 17h
Merged PRs (30d)
71

Description

### Describe the bug

The CDK CLI dynamically load "CDK_" env var.
I use `CDK_METHOD=template `for `diff` to bypass change set.
Unfortunately, deploy use the same keyword with different value.

### Regression Issue

- [ ] Select this option if this issue appears to be a regression.

### Last Known Working CDK Version

_No response_

### Expected Behavior

`CDK_METHOD` should not colision between `cdk diff `and `cdk cli`.

### Current Behavior

When set `CDK_METHOD=template`, deploy does not recognize the value
```
Invalid values:
Argument: method, Given: "template", Choices: "direct", "change-set", "prepare-change-set", "execute-change-set"
```

### Reproduction Steps

```
export CDK_METHOD=template
cdk diff
cdk deploy
```
Invalid values:
Argument: method, Given: "template", Choices: "direct", "change-set", "prepare-change-set", "execute-change-set"

### Possible Solution

Probably should used different key word between the two actions.

### Additional Information/Context

_No response_

### CDK CLI Version

2.1139.0

### Framework Version

_No response_

### Node.js Version

v24.14.0

### OS

mac

### Language

TypeScript

### Language Version

_No response_

### Other information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue with CDK_METHOD=template, then trace how the cdk diff and cdk deploy entry points parse that environment variable. Done means the setting used by diff no longer causes deploy to reject its method value, with coverage for both commands.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, node.js, typescript
Domain
cli, infrastructure
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.