aws / aws/aws-cdk

Detecting drift from the command line

Open
#24,494 4 comments 2 reactions 0 assignees View on GitHub
@aws-cdk/aws-cloudformation @aws-cdk/core feature-request p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the bug

Some of the stack names listed with `cdk list` cannot be fed into `aws cloudformation --stack-name `.

### Expected Behavior

The `cloudformation` module of the AWS CLI should accept the stack names listed in `cdk list`, or the other way around.

### Current Behavior

Some of the stack names listed with `cdk list` cannot be fed into `aws cloudformation --stack-name `.

### Reproduction Steps

First, get a list of stacks:
```
$ cdk list
building... [omitted for clarity]

playground1
playground1-safetynet
playground1/es-hist-cluster1
playground1/es-rt-cluster1
```

Now, detect the drift:
```
$ aws cloudformation detect-stack-drift --stack-name "playground1/es-rt-cluster1"

An error occurred (ValidationError) when calling the DetectStackDrift operation:
1 validation error detected: Value 'playground1/es-rt-cluster1' at 'stackName' failed to satisfy constraint:
Member must satisfy regular expression pattern: [a-zA-Z][-a-zA-Z0-9]*|arn:[-a-zA-Z0-9:/._+]*
```

### Possible Solution

_No response_

### Additional Information/Context

_No response_

### CDK CLI Version

2.67.0 (build b6f7f39)

### Framework Version

_No response_

### Node.js Version

v19.6.1

### OS

macOS 13.1

### Language

Java

### Language Version

_No response_

### Other information

_No response_

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with the shown `cdk list` output and the AWS CLI `detect-stack-drift --stack-name` command. Trace how stack names are produced by the CDK CLI and compare them with the CloudFormation stack-name constraint. Done means the listed names and CloudFormation commands are compatible, with coverage for names like `playground1/es-rt-cluster1`.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cli, cloud, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.