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
Draft: adjust public API #31
Conversation
Note that I've opened this as a draft for discussion. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks crisper and cleaner for a CDK user IMO.
cc @eladb for visibility |
The proposed public API requires that users subclass pulumicdk.Stack (which is itself a subclass of cdk.Stack) and call `this.synth()` at the end of the subclass's constructor. `synth` is provided by `pulumicdk.Stack` and does the work of creating a Pulumi component resource, synthesizing the CDK resources, etc.
2116273
to
c117e73
Compare
new CfnOutput(this, 'url', { value: service.serviceUrl }); | ||
this.url = this.asOutput(service.serviceUrl); | ||
|
||
this.synth(); | ||
} | ||
} | ||
|
||
const stack = new pulumicdk.Stack('teststack', AppRunnerStack); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I expected this to be new AppRunnerStack('teststack')
, no?
new CfnOutput(this, 'url', { value: service.serviceUrl }); | ||
this.url = this.asOutput(service.serviceUrl); | ||
|
||
this.synth(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way to at least discover that the stack was not synthesized and emit an error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks much more idiomatic! Love it.
The requirement to perform this.synth()
is a bit of a bummer. Is there a way to at least discover that a stack was not synthed? Maybe an exit hook with some global ugliness?
The proposed public API requires that users subclass pulumicdk.Stack
(which is itself a subclass of cdk.Stack) and call
this.synth()
at theend of the subclass's constructor.
synth
is provided bypulumicdk.Stack
and does the work of creating a Pulumi componentresource, synthesizing the CDK resources, etc.