where can we learn more about how to attach IAM pe...
# help
s
where can we learn more about how to attach IAM permissions to certain resources in a stack, have a stack reference a resource in another stack, etc?
I think this is the answer to stack dependency/deploy order: https://serverless-stack.com/chapters/deploy-a-serverless-app-with-dependencies.html
actually.. beyond the deployment, I’m curious about the proper way for Lambda code to reference other Lambda function names, or get ARNs of resources, without hardcoding anything
f
Hey @Sam Hulick, do you mean something like this?
Copy code
const fn1 = new sst.Function(...);
const fn2 = new sst.Function(this, "Fn2", {
  handler: ...,
  environment: {
    FN1_ARN: fn1.functionArn,
  }
});
s
@Frank Yes, exactly! Thank you. BTW, is it a typical best practice to just do
import * as sst
or
import * as iam
(from CDK) for clarity, rather than destructuring, since this code isn't actually part of the actual app and so tree-shaking doesn't matter?
f
Yeah, shouldn’t matter. SST uses esbuild behind the scene and it tree-shakes.
s
I figured. thanks!