elegant-crayon-4967
04/28/2021, 9:14 PMbillowy-army-68599
04/28/2021, 9:16 PMelegant-crayon-4967
04/28/2021, 9:17 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
04/28/2021, 9:27 PMelegant-crayon-4967
04/28/2021, 9:28 PMbillowy-army-68599
04/28/2021, 9:42 PMelegant-crayon-4967
04/28/2021, 9:44 PMbillowy-army-68599
04/28/2021, 9:45 PMobjectIds
type is correctelegant-crayon-4967
04/28/2021, 9:47 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
04/29/2021, 4:40 PMelegant-crayon-4967
04/29/2021, 5:10 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)
OutputImpl {….
billowy-army-68599
04/29/2021, 5:20 PMconsole.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 PM.apply
agains the array?billowy-army-68599
04/29/2021, 5:29 PMelegant-crayon-4967
04/29/2021, 5:31 PM