sparse-intern-71089
04/28/2021, 9:14 PMbillowy-army-68599
elegant-crayon-4967
04/28/2021, 9:17 PMelegant-crayon-4967
04/28/2021, 9:24 PMelegant-crayon-4967
04/28/2021, 9:24 PMconst objectIds = [];
fs.readdir('components', (err, files) => {
if (err) {
return console.log('Unable to scan directory:' + err);
}
files.forEach((file) => {
const fileName = file.split(".");
const filePath = require("path").join('components', file)
// Upload File to S3
const componentObject = new aws.s3.BucketObject(`${config.name}-${fileName[0]}-object`, {
key: file,
source: new pulumi.asset.FileAsset(filePath),
bucket: bucket.id
});
objectIds.push({
objectId: componentObject.id
});
});
billowy-army-68599
elegant-crayon-4967
04/28/2021, 9:28 PMelegant-crayon-4967
04/28/2021, 9:29 PMbillowy-army-68599
billowy-army-68599
elegant-crayon-4967
04/28/2021, 9:44 PMbillowy-army-68599
objectIds
type is correctbillowy-army-68599
elegant-crayon-4967
04/28/2021, 9:47 PMelegant-crayon-4967
04/28/2021, 9:56 PMOutputImpl {
__pulumiOutput: true,
resources: [Function (anonymous)],
allResources: [Function (anonymous)],
isKnown: Promise { <pending> },
isSecret: Promise { <pending> },
promise: [Function (anonymous)],
toString: [Function (anonymous)],
toJSON: [Function (anonymous)]
}
billowy-army-68599
elegant-crayon-4967
04/29/2021, 5:10 PMelegant-crayon-4967
04/29/2021, 5:17 PMexport let objectIds: pulumi.Output<string>[] = []
const objects = ["installSsm.yml"].map((name) => {
let obj = new aws.s3.BucketObject(name, {
bucket: bucket.id,
source: new pulumi.asset.FileAsset(`./components/${name}`),
})
objectIds.push(obj.id)
//console.log(obj.id)
})
console.log(objectIds)
elegant-crayon-4967
04/29/2021, 5:18 PMOutputImpl {….
elegant-crayon-4967
04/29/2021, 5:19 PMbillowy-army-68599
console.log
won't work because it's asynchronously resolved. With the export, did it show you the values?elegant-crayon-4967
04/29/2021, 5:23 PMelegant-crayon-4967
04/29/2021, 5:23 PM.apply
agains the array?billowy-army-68599
elegant-crayon-4967
04/29/2021, 5:31 PM