cool-dress-96114
10/21/2021, 9:16 PM<http://github.com/pulumi/pulumi/sdk/v3/go/pulumi.marshalInput({0x18b6000|github.com/pulumi/pulumi/sdk/v3/go/pulumi.marshalInput({0x18b6000>, 0xc0001b08c0}, {0x1a6ec10, 0x181b1a0}, 0x1)
/Users/jordan/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.15.0/go/pulumi/rpc.go:281 +0x27c5
<http://github.com/pulumi/pulumi/sdk/v3/go/pulumi.marshalInput({0x18b6000|github.com/pulumi/pulumi/sdk/v3/go/pulumi.marshalInput({0x18b6000>, 0xc0001b08c0}, {0x1a6ec10, 0x181b1a0}, 0x1)
/Users/jordan/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.15.0/go/pulumi/rpc.go:281 +0x27c5
<http://github.com/pulumi/pulumi/sdk/v3/go/pulumi.marshalInput({0x18b6000|github.com/pulumi/pulumi/sdk/v3/go/pulumi.marshalInput({0x18b6000>, 0xc0001b08c0}, {0x1a6ec10, 0x181b1a0}, 0x1)
/Users/jordan/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.15.0/go/pulumi/rpc.go:281 +0x27c5
<http://github.com/pulumi/pulumi/sdk/v3/go/pulumi.marshalInput({0x18b6000|github.com/pulumi/pulumi/sdk/v3/go/pulumi.marshalInput({0x18b6000>, 0xc0001b08c0}, {0x1a6ec10, 0x181b1a0}, 0x1)
/Users/jordan/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.15.0/go/pulumi/rpc.go:281 +0x27c5
...additional frames elided...
created by <http://github.com/pulumi/pulumi/sdk/v3/go/pulumi.(*Context).registerResource|github.com/pulumi/pulumi/sdk/v3/go/pulumi.(*Context).registerResource>
/Users/jordan/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.15.0/go/pulumi/context.go:773 +0x772
exit status 2
Any ideas would be greatly appreciated as I am not sure how to debug thispackage main
import (
"io/ioutil"
"mime"
"path"
"path/filepath"
"<http://github.com/pulumi/pulumi-aws/sdk/v4/go/aws/s3|github.com/pulumi/pulumi-aws/sdk/v4/go/aws/s3>"
"<http://github.com/pulumi/pulumi/sdk/v3/go/pulumi|github.com/pulumi/pulumi/sdk/v3/go/pulumi>"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
// Create a bucket and expose a website index document
siteBucket, err := s3.NewBucket(ctx, "my-bucket", &s3.BucketArgs{
Website: s3.BucketWebsiteArgs{
IndexDocument: pulumi.String("index.html"),
},
})
if err != nil {
return err
}
siteDir := "www" // directory for content files
// For each file in the directory, create an S3 object stored in `siteBucket`
files, err := ioutil.ReadDir(siteDir)
if err != nil {
return err
}
for _, item := range files {
name := item.Name()
print(item.Name())
if _, err := s3.NewBucketObject(ctx, name, &s3.BucketObjectArgs{
Bucket: siteBucket.ID(), // reference to the s3.Bucket object
Source: pulumi.NewFileAsset(filepath.Join(siteDir, name)), // use FileAsset to point to a file
ContentType: pulumi.String(mime.TypeByExtension(path.Ext(name))), // set the MIME type of the file
}); err != nil {
return err
}
}
// Set the access policy for the bucket so all objects are readable.
if _, err := s3.NewBucketPolicy(ctx, "bucketPolicy", &s3.BucketPolicyArgs{
Bucket: siteBucket.ID(), // refer to the bucket created earlier
Policy: pulumi.Any(map[string]interface{}{
"Version": "2012-10-17",
"Statement": []map[string]interface{}{
{
"Effect": "Allow",
"Principal": "*",
"Action": []interface{}{
"s3:GetObject",
},
"Resource": []interface{}{
pulumi.Sprintf("arn:aws:s3:::%s/*", siteBucket.ID()), // policy refers to bucket name explicitly
},
},
},
}),
}); err != nil {
return err
}
// Stack exports
ctx.Export("bucketName", siteBucket.ID())
ctx.Export("websiteUrl", siteBucket.WebsiteEndpoint)
return nil
})
}
little-soccer-5693
10/21/2021, 9:29 PMbillowy-army-68599
little-soccer-5693
10/22/2021, 2:53 PMbillowy-army-68599
little-soccer-5693
10/22/2021, 3:55 PMbillowy-army-68599
little-soccer-5693
10/22/2021, 4:10 PMbillowy-army-68599
go.mod
in the issue?little-soccer-5693
10/22/2021, 4:10 PMbillowy-army-68599