-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider making Construct stack-aware #798
Comments
I would have loved to have something like this before, but I was under the impression the rationale for not having it was to avoid tying ourselves to CloudFormation concepts. |
That’s correct, the question is whether we define a Stack as a CloudFormation concept or a more general one. |
As an implementation note, |
I think making Anyhow - I'm adding those couple of convenience accessors, because I'm real tired of |
Makes it easier to access some construct's `Stack`, avoiding having to sprinkle `Stack.find(this)` everywhere. While there, added `construct.node.formatArn` and `construct.node.parseArn` as convenience methods to avoid indirecting via the `Stack`. BREAKING CHANGE: `Stack.find(c)` and `Stack.tryFind(c)` were replaced by `c.node.stack`. Fixes #798
Makes it easier to access some construct's `Stack`, avoiding having to sprinkle `Stack.find(this)` everywhere. BREAKING CHANGE: `Stack.find(c)` and `Stack.tryFind(c)` were replaced by `c.node.stack`. Fixes #798
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 writeStack.find(this)
instead of something likethis.stack
. Similarly, if I want to find a resource, I can usethis.findChild
but have to cast it down tocdk.Resource
. Would have been handy to havethis.findResource
, etc.A possible simple solution to this is to convert the base
Construct
toBaseConstruct
and then define a new classConstruct
which will beStack
andResource
aware and will have the desired APIs.Brought up by @ccurrie-amzn in a discussion over #784
The text was updated successfully, but these errors were encountered: