This message was deleted.
# typescript
s
This message was deleted.
m
npm run build
and something like this in your plan:
Copy code
const lambdaFunctionArgs = {
  code: new pulumi.asset.FileArchive("./dist/app"),
  memorySize: 128,
  environment: {
    variables: {
      API_BASE_PATH: apiBasePath,
    },
  },
  handler: "lambdaApiHandler.handler",
  role: applicationRole.arn,
  runtime: aws.lambda.NodeJS12dXRuntime,
};

const lambdaFunctionApi = new aws.lambda.Function(
  `${appName}-api`,
  lambdaFunctionArgs,
  { dependsOn: [applicationRole] },
);
m
Sorry that's not what I'm asking. I know how to bundle separately and reference the function as an archive but what I want is to be able to put pulumi references in the application code and have them actually together. So my application code could just reference, for example, an s3 bucket output, without having to create more indirection and push it through an env var
m
I use the latter strategy of passing environment variables, which helps me with local development as well. However, if I'm understanding correctly, you want to use Pulumi as a library in your application code and get outputs from a stack. For this case (and I'm not sure this is the canonical way) you can use the automation api and select the stack, and get the outputs. https://www.pulumi.com/docs/guides/automation-api/ Hints about the implementation here: https://github.com/pulumi/automation-api-examples/blob/main/nodejs/localProgram-tsnode/automation/index.ts#L23-L43 Reference docs here: https://www.pulumi.com/docs/reference/pkg/nodejs/pulumi/pulumi/automation/ This would presumably require a docker image for the lambda runtime to include the Pulumi CLI, as the automation API wraps it.
1