```const adminBucketDir = `${__dirname}/../build/`...
# aws
g
Copy code
const adminBucketDir = `${__dirname}/../build/`;
const updatedFiles: BucketObject[] = [];
crawlDirectory(adminBucketDir, (filePath: string) => {
  const relativeFilePath = filePath.replace(adminBucketDir + "/", "");
  console.log(relativeFilePath, filePath);
  const contentFile = new aws.s3.BucketObject(
    relativeFilePath,
    {
      key: relativeFilePath,
      acl: "public-read",
      bucket: config.adminBucket,
      contentType: mime.getType(filePath) || undefined,
      source: new pulumi.asset.FileAsset(filePath),
    }
  );
  updatedFiles.push(contentFile);
});
b
what is
config.adminBucket
set to?
g
the actual bucket (export const adminBucket = new aws.s3.Bucket) from our core infra config
I could add an export for adminBucket.id and forward that?
b
what’s its value? it seems to be the wrong type. I would export const config.adminBucket first to see what the value is set to
g
Copy code
pulumi:pulumi:Stack (admin-dev):
    OutputImpl {
      __pulumiOutput: true,
      resources: [Function (anonymous)],
      allResources: [Function (anonymous)],
      isKnown: Promise { <pending> },
      isSecret: Promise { <pending> },
      promise: [Function (anonymous)],
      toString: [Function (anonymous)],
      toJSON: [Function (anonymous)]
    }
that’s my console log, it should be a Output<Bucket>
I can try apply and then .id or something too perhaps?
b
yeah that’s likely the issue
g
Copy code
const updatedFiles: BucketObject[] = [];
config.adminBucket.apply(bucket => {
  const adminBucketDir = `${__dirname}/../build/`;
  crawlDirectory(adminBucketDir, (filePath: string) => {
    const relativeFilePath = filePath.replace(adminBucketDir + "/", "");
    console.log(relativeFilePath, filePath);
    const contentFile = new aws.s3.BucketObject(
      relativeFilePath,
      {
        key: relativeFilePath,
        acl: "public-read",
        bucket: bucket.id,
        contentType: mime.getType(filePath) || undefined,
        source: new pulumi.asset.FileAsset(filePath),
      }
    );
    updatedFiles.push(contentFile);
  });
})
This seems to be successful, I’m going to export the id and see if I need to apply
with just bucket it was still failing
b
you shouldn’t need to
g
we’re good, I’ll start using
bucket.id
over
bucket
for
new aws.s3.BucketObject
in the future cheers for the help