Pulumi should not be stripping newlines or otherwise manipulating your console.log()
output. I just tested this and my string with newlines was printed as expected with newlines.
Code
import * as aws from "@pulumi/aws";
const bucket = new aws.s3.Bucket("main", {
acl: "private",
})
bucket.onObjectCreated("logger", new aws.lambda.CallbackFunction<aws.s3.BucketEvent, void>("loggerFn", {
memorySize: 128,
callback: (e) => {
for (const rec of e.Records || []) {
const [buck, key] = [rec.s3.bucket.name, rec.s3.object.key];
console.log(`Object created: ${buck}/${key}`);
}
},
}));
console.log(`My
multi-line
string`);
export const bucketName = bucket.bucket;
Output
$ pulumi up -y
Previewing update (dev):
Type Name Plan Info
+ pulumi:pulumi:Stack demo-aws-ts-serverless-dev create 3 ...
+ └─ aws:lambda:Function loggerFn create
Diagnostics:
pulumi:pulumi:Stack (demo-aws-ts-serverless-dev):
My
multi-line
string
Resources:
+ 8 to create
Updating (dev):
Type Name Status Info
+ pulumi:pulumi:Stack demo-aws-ts-serverless-dev created ...
+ └─ aws:lambda:Function loggerFn created
Diagnostics:
pulumi:pulumi:Stack (demo-aws-ts-serverless-dev):
My
multi-line
string
Outputs:
bucketName: "main-b568df3"
Resources:
+ 8 created
...