thdxr
01/21/2022, 3:24 AMexport async function TableStack(props) {
const table = new sst.Table(props.stack, ...);
return { table };
}
export async function StackB(props) {
const { table } = use(TableStack);
new sst.Function(props.stack, { environment: { MYTABLE: table } })
}
It would be totally typesafe + support async functionsSam Hulick
01/21/2022, 3:54 AMthdxr
01/21/2022, 4:00 AMclass TableStack extends sst.Stack {
public readonly table: sst.Table
constructor(...) {
super(..)
this.table = new sst.Table(...)
}
}
class StackB extends sst.Stack {
constructor(app, props: { table: sst.Table }) {
super(...)
}
}
const tableStack = new TableStack(app)
new StackB(app, { table: tableStack.table })
thdxr
01/21/2022, 4:00 AMSam Hulick
01/21/2022, 5:07 AMthdxr
01/21/2022, 5:08 AMGarret Harp
01/21/2022, 10:42 AMDevin
01/21/2022, 11:52 AMJoe Kendal
01/21/2022, 12:26 PMMatt Morgan
01/21/2022, 2:17 PMTableStack
gets deployed before StackB
begins to synth? If not that, then what? CDK is synchronous by design.Matt Morgan
01/21/2022, 2:18 PMthdxr
01/21/2022, 2:27 PMMatt Morgan
01/21/2022, 2:29 PMexecSync
, though if somebody said that's a hack, I wouldn't really disagree. I'd just be wary of anything that might make it non-deterministic. Having the whole thing be synchronous was a design goal of the CDK.Ross Gerbasi
01/21/2022, 4:26 PMAdam Fanello
01/21/2022, 5:49 PMthdxr
01/21/2022, 5:51 PMRoss Gerbasi
01/21/2022, 5:51 PMthdxr
01/21/2022, 5:53 PMRoss Gerbasi
01/21/2022, 5:53 PMRoss Gerbasi
01/21/2022, 5:55 PMthis.createStack(scope, id)
and createStack
was async.thdxr
01/21/2022, 5:55 PMSam Hulick
01/21/2022, 5:56 PMRoss Gerbasi
01/21/2022, 5:56 PMindex.ts
How is it that you can have callbacks and promises in your default index handler?? how does it know to wait haha i am very curiousRoss Gerbasi
01/21/2022, 5:57 PMRoss Gerbasi
01/21/2022, 5:57 PMthdxr
01/21/2022, 5:57 PMmain
and wait for all async work to finish before exitingSam Hulick
01/21/2022, 5:57 PMthdxr
01/21/2022, 5:57 PMRoss Gerbasi
01/21/2022, 5:58 PMRoss Gerbasi
01/21/2022, 5:58 PMJoe Kendal
01/21/2022, 5:58 PMthdxr
01/21/2022, 5:58 PMRoss Gerbasi
01/21/2022, 5:58 PMSam Hulick
01/21/2022, 5:58 PMgetSsmParameter
function that also memoizes the values it fetches. just cache it so it’s there for any warm startsRoss Gerbasi
01/21/2022, 5:59 PMSam Hulick
01/21/2022, 5:59 PMRoss Gerbasi
01/21/2022, 5:59 PMRoss Gerbasi
01/21/2022, 5:59 PMRoss Gerbasi
01/21/2022, 5:59 PMRoss Gerbasi
01/21/2022, 6:00 PMthdxr
01/21/2022, 6:01 PMthdxr
01/21/2022, 6:01 PMRoss Gerbasi
01/21/2022, 6:01 PMRoss Gerbasi
01/21/2022, 6:02 PMAdam Fanello
01/21/2022, 6:02 PMRoss Gerbasi
01/21/2022, 6:04 PM{{resolve}}
into ENVS so we are never passing alot plaintext secretsRoss Gerbasi
01/21/2022, 6:05 PMthdxr
01/21/2022, 6:05 PMthdxr
01/21/2022, 6:05 PMRoss Gerbasi
01/21/2022, 6:05 PMthdxr
01/21/2022, 6:05 PMthdxr
01/21/2022, 6:06 PMRoss Gerbasi
01/21/2022, 6:06 PMRoss Gerbasi
01/21/2022, 6:07 PMthdxr
01/21/2022, 6:09 PMRoss Gerbasi
01/21/2022, 6:10 PMCarlos Daniel
01/21/2022, 6:29 PMAdam Fanello
01/21/2022, 7:36 PMRoss Gerbasi
01/21/2022, 7:41 PM