billions-egg-86119
11/06/2024, 2:29 PMfuture-hairdresser-70637
11/06/2024, 3:54 PMbillions-egg-86119
11/06/2024, 4:16 PMbillions-egg-86119
11/06/2024, 4:18 PMlittle-cartoon-10569
11/06/2024, 6:53 PMbillions-egg-86119
11/06/2024, 6:56 PM// IAM Policy Document that allows the Lambda service to write to the S3 bucket
		s3Bucket.Arn.ApplyT(func(arn string) (string, error) {
			policy := fmt.Sprintf(`{
				"Version": "2012-10-17",
				"Statement": [{
					"Effect": "Allow",
					"Principal": {"Service": "<http://lambda.amazonaws.com|lambda.amazonaws.com>"},
					"Action": ["s3:PutObject", "s3:PutObjectAcl"],
					"Resource": "%s/*"
				}]
			}`, arn)
			// Attach the policy to the bucket
			_, err := s3.NewBucketPolicy(ctx, "myBucketPolicy", &s3.BucketPolicyArgs{
				Bucket: s3Bucket.ID(),
				Policy: pulumi.String(policy),
			})
			if err != nil {
				return "", err
			}
			return "", nil
		})little-cartoon-10569
11/06/2024, 6:59 PMlittle-cartoon-10569
11/06/2024, 7:01 PMbillions-egg-86119
11/06/2024, 7:02 PMlittle-cartoon-10569
11/06/2024, 7:02 PMbillions-egg-86119
11/06/2024, 7:02 PM