Skip to content

Consider making Construct stack-aware #798

@eladb

Description

@eladb

We are starting to realize that the fact the Construct is not stack-aware hinders our ability to provide a good experience. For example, to get a handle to the stack, users need to write Stack.find(this) instead of something like this.stack. Similarly, if I want to find a resource, I can use this.findChild but have to cast it down to cdk.Resource. Would have been handy to have this.findResource, etc.

A possible simple solution to this is to convert the base Construct to BaseConstruct and then define a new class Construct which will be Stack and Resource aware and will have the desired APIs.

Brought up by @ccurrie-amzn in a discussion over #784

Metadata

Metadata

Assignees

Labels

@aws-cdk/coreRelated to core CDK functionalityeffort/smallSmall work item – less than a day of effortfeature-requestA feature should be added or improved.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions