Hi, (newbie question maybe), I use Pulumi to creat...
# getting-started
s
Hi, (newbie question maybe), I use Pulumi to create dynamodb table. Now it auto-renames by appending a random number to my db name. I know it can be avoided by providing “name” field, but without that, how can I access the random generated table name from within my lambda?
w
you can reference it via code if they are in the same codebase.
Copy code
const db = new aws.dynamodb.Table(...)
//reference it
db.arn
if not, you could possibly export db from stack A as stack output and import it from stack B where your lambda is. https://www.pulumi.com/docs/intro/concepts/stack/#stackreferences That said, it’s always a good practice to specify name where possible. Note some resources might not have
name
available.
s
Hi @wet-fall-57893 yes they are in same codebase and part of same stack. Are you saying, I can hardcode the random table name generated?
db.arn
can only be accessed within the pulumi typescript file right
?
w
set it as ENV var so that you can access it from within your lambda handler
s
Thanks @wet-fall-57893, that makes me curious, is there a way to configure Env variables on Lambda functions directly from Pulumi during deployment itself?