aws / aws/aws-cdk

(core): `cdk synth` always synthesizes every stack

Open
#35,544 22 comments 55 reactions 0 assignees View on GitHub
@aws-cdk/core effort/large feature-request p1
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

## :question: General Issue

I have multiple stacks in my project and want I deploy only one of them all other stack assets must be present in file tree or else I get `ENOENT: no such file or directory, stat...`.

I did a little digging and figured:
a. cdk cli spawns process `ts-node /bin/script.ts`
b. cdk cli does not pass stack name to aws-cdk, therefore I cannot know which should be synthesized
c. aws-cdk generates all cloudformation jsons for all stacks it can find and cdk cli picks the ones it needs

I think it would be smart to provide the name of stack and generate only provided one, it would be faster and would not require all assets to be present.

PS.
With aws-cli I'm referening to aws-cdk installed globally and with aws-cdk I refer to project dependency.

### The Question

1. I wonder what was the reasoning for current approach and should it be changed?
2. Maybe I'm missing something and this can be easily resolved?

### Environment

- **CDK CLI Version: 1.27.0 (build a98c0b3)
- **Module Version: "@aws-cdk/core": "^1.27.0"
- **OS: MacOs Mojave
- **Language: Typescript

### Other information

Contributor guide

Open the contributing guide

Research direction

Start by tracing the CDK CLI invocation described in the issue (`ts-node /bin/script.ts`) and how it selects synthesized stacks. The issue proposes passing the requested stack name so only that stack is synthesized; done would mean deploying one stack no longer requires unrelated stacks' assets to be present. The discussion is old, so check for any later decision before starting.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.