https://pulumi.com logo
#general
Title
# general
b

breezy-laptop-42679

08/04/2022, 12:41 PM
Copy code
/*
   *   s3 public access block
   */
const bucketNameList = ["prod-nueve-media-9184fce"]
const bucketIdList: pulumi.Output<string>[] = []

bucketNameList.forEach(bucketName => {
  // Create an AWS resource (S3 Bucket) 
  const bucket = new aws.s3.Bucket(bucketName, {});
  bucketIdList.push(bucket.id)
});

for (let index = 0; index < bucketIdList.length; index++) {
  new aws.s3.BucketPublicAccessBlock(`${bucketNameList[index]}-publicAccessBlock`, {
    bucket: bucketIdList[index],
    blockPublicAcls: true,
    blockPublicPolicy: true,
  });
}