-
Notifications
You must be signed in to change notification settings - Fork 6
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
Cannot pass props to root
#26
Comments
Thank for raising the issue! Indeed, this is current limitation. In order to overcome this limitation you can use const app = new cdk.App()
const config = {
env: {
account: process.env.CDK_DEFAULT_ACCOUNT,
region: process.env.CDK_DEFAULT_REGION,
}
}
const stack = new cdk.Stack(app, 'mystack', { ...config })
pure.join(stack, ...) What is the right evolution of export function root<T>(scope: App, fn: IaaC<T>, name?: string, props?: cdk.StackProps): App {
fn(new Stack(scope, name || fn.name), props)
return scope
} Atm I am considering the following construct, however it would introduce incompatible change. // root is an App
const app = pure.root()
// Stack is just any other construct
const MyStack = (): cdk.StackProps => ...
const stack = pure.iaac(MyStack)
pure.join(app, stack) |
The second solution seems simpler. But why do we need const app = new cdk.App();
const config = { env };
pure.join(app, cloud.stack(() => config, 'MyApp').effect(MyStack)); So Edit: maybe I'm oversimplifying things. Getting the types to work out is probably difficult. |
Exactly! The |
I need to pass
env
to the root stack, but I can't becausepure.root
doesn't take props as an argument.The text was updated successfully, but these errors were encountered: