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

cool-dress-96114

10/21/2021, 9:16 PM
Hi there, trying to evaluate Pulumi and doing the AWS tutorial to files to S3 here: https://pulumi.awsworkshop.io/20_cloud_engineering_python/20_getting_started_with_pulumi/30_updating_infrastructure.html Getting a stack overflow that times out
Copy code
<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 this
whole go file/project:
Copy code
package 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
	})
}
l

little-soccer-5693

10/21/2021, 9:29 PM
@cool-dress-96114 just a heads up i'm hitting a similar error and posted q in #getting-started
b

billowy-army-68599

10/21/2021, 10:11 PM
I'm taking a look at this now
this looks to be a bug, sorry for the inconvenience
l

little-soccer-5693

10/22/2021, 2:53 PM
@billowy-army-68599 do you have a sense for ETA of a fix? is there a workaround for just walking through the tutorials?
b

billowy-army-68599

10/22/2021, 3:05 PM
@little-soccer-5693 we have someone working on it, but in the meantime you can downgrade your CLI: https://github.com/pulumi/pulumi-aws/issues/1675#issuecomment-949060717
l

little-soccer-5693

10/22/2021, 3:55 PM
@billowy-army-68599 thanks for the reference. the bug reproduces on v3.12.0 and v3.10.3 as well. i added a note saying as much in the bug report
b

billowy-army-68599

10/22/2021, 3:56 PM
that's appreciated, thank you. we're really sorry for the inconvenience
l

little-soccer-5693

10/22/2021, 4:10 PM
@billowy-army-68599 on a hunch i tweaked my project's go.mod to downgrade the pulumi SDK version as well and that seemed to work. so i'm unblocked for now. thank you again for the help.
b

billowy-army-68599

10/22/2021, 4:10 PM
would you mind posting your
go.mod
in the issue?
l

little-soccer-5693

10/22/2021, 4:10 PM
yes already did
b

billowy-army-68599

10/22/2021, 4:11 PM
awesome, thank you!
3 Views