pulumi / pulumi-ai

222 stars 15 forks source link

Pulumi AI hallucinating about CORS in aws.apigateway.v2 #57

Closed jestoncolelewis closed 7 months ago

jestoncolelewis commented 9 months ago

What happened?

I am working on enabling CORS for an API and asked the AI to point me in the right direction. I provided this prompt:

add cors to http api

and it provided this result:

import pulumi
from pulumi_aws import apigatewayv2

# Create HTTP API
http_api = apigatewayv2.Api("httpApi", 
    protocol_type="HTTP",
    target="example.com",
)

# Add CORS to HTTP API
cors = apigatewayv2.Cors("cors",
    api_id=http_api.id,
    allow_headers=[
        "x-Api-User",
        "x-Api-Key",
    ],
    allow_methods=[
        "GET",
        "POST",
        "PUT",
    ],
    allow_origins=[
        "example.com",
    ],
    expose_headers=[
        "x-Api-User",
        "x-Api-Key",
    ],
    max_age=300,
)

# Export the API ID
pulumi.export("api_id", `http_api.id)

The Cors class doesn't seem to exist and the response also includes a link to a Cors resource that doesn't exist - link

Example

Not really applicable as this is an issue outside of my environment.

Output of pulumi about

Again, outside of my environment

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).

wongstein commented 7 months ago

Hi! Thanks for the report. We've made some changes to pulumi.ai and are hoping this issue is fixed.

If you are still looking for support on CORS, try this conversation: https://www.pulumi.com/ai/conversations/b77b1784-4046-4242-9bbd-b92b8e4d785a

If you're still seeing the CORs hallucination in the future, please feel free to reopen the issue.