aws / aws/aws-cdk

import: support running import on multiple stacks at once

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

Description

### Describe the feature

Currently import does not allow selecting multiple stacks (e.g. `cdk import '**'`). Ideally, this is something cdk would support.

### Use Case

I have a complex continually evolving app with multiple stacks that have resources that need to be imported, and I would like to run `import` on all of them at once

### Proposed Solution

I think the functionality is somewhat straightforward. The main point of variability that I foresee is the logistics around getting the resource identifiers for each stack. For this, I think there are a few options, but my intuition is that the resource-mapping file be structured like:
```
{
"StackName": {
"ResourceLogicalId": {
"ResourceIdentifierProperty": "ResourceIdentifierValue"
}
}
}
```
Although, maybe when importing a single stack, the resource-mapping file can still use the current structure (i.e. skip the "StackName" field).

For the prompting system, it basically would just need to be done for each stack, and it can either be done all at once at the beginning or it can complete the import operation for each stack before prompting for resource identifiers for the next one.

There could also be logic to prompt for resource identifiers for stacks that do not appear in the resource-mapping file so that resource identifiers for some stacks can come from the resource-mapping file and for other stacks they can come from prompts. Although, that is certainly not necessary functionality.

### Other Information

_No response_

### Acknowledgements

- [ ] I may be able to implement this feature request
- [ ] This feature might incur a breaking change

### CDK version used

2.29.1

### Environment details (OS name and version, etc.)

Windows 10 Enterprise Version 10.0.19044

Contributor guide

Open the contributing guide

Research direction

Start by locating the CDK import command and its current single-stack resource-mapping and prompting flow. Determine how multi-stack selection, per-stack identifiers, and prompting should work, then define completion criteria for importing all selected stacks without breaking single-stack behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cli, cloud, infrastructure
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.