pulumi / pulumi-ai

222 stars 15 forks source link

Formatting incorrect on the policy within a bucket #51

Closed pierskarsenbarg closed 8 months ago

pierskarsenbarg commented 10 months ago

What happened?

Following conversation: https://www.pulumi.com/ai/?convid=491bfe17-1cb5-4b0d-b0ef-bd3c9c4e6256

  1. The policy is written to the comment instead of the next line
  2. The "Policy" needs a colon after it
const bucketForWebsite = new aws.s3.Bucket("websiteBucket", { 
    acl: "public-read",
    bucket: `website-bucket-${Date.now().toString()}`, // A random bucket name, real use may want a more predictable name    policy JSON.stringify({
        Version: "2012-10-17",
        Statement: [
            {
                Effect: "Allow", 
                Principal: "*", 
                Action: "s3:GetObject", 
                Resource: `arn:aws:s3:::website-bucket-${Date.now().toString()}/*`, // Allow anyone to read all objects from the bucket
            }
        ]
    }),
});

Expected Behavior

Should look more like this:

const bucketForWebsite = new aws.s3.Bucket("websiteBucket", { 
    acl: "public-read",
    bucket: `website-bucket-${Date.now().toString()}`, // A random bucket name, real use may want a more predictable name   
    policy: JSON.stringify({
        Version: "2012-10-17",
        Statement: [
            {
                Effect: "Allow", 
                Principal: "*", 
                Action: "s3:GetObject", 
                Resource: `arn:aws:s3:::website-bucket-${Date.now().toString()}/*`, // Allow anyone to read all objects from the bucket
            }
        ]
    }),
});

Steps to reproduce

Link to conversation: https://www.pulumi.com/ai/?convid=491bfe17-1cb5-4b0d-b0ef-bd3c9c4e6256

Output of pulumi about

n/a

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

AaronFriel commented 9 months ago

This looks to me like one or more dropped tokens on the backend, adding a \n and :, I think we can close this as a fixed duplicate of #45.

AaronFriel commented 8 months ago

I think we've resolved this as part of #45. While generative AI models can still generate incorrect formatting, we haven't seen any new issues of dropped tokens in some time.