pulumi / pulumi-aws-apigateway

Apache License 2.0
12 stars 5 forks source link

Warnings on S3 objects created with this plugin #134

Closed jamest-pin closed 8 months ago

jamest-pin commented 8 months ago

What happened?

I get this warning on every apply:

 warning: urn:pulumi:myapp::aws-apigateway:index:RestAPI$aws:s3/bucketObject:BucketObject::api_app4c238266/favicon.ico verification warning: use the aws_s3_object resource instead

Slack thread: https://pulumi-community.slack.com/archives/CRH5ENVDX/p1703063228853249?thread_ts=1703036443.323509&cid=CRH5ENVDX

Example

I do this:


  ##
  # Frontend/App
  # Serve the frontend from an S3 bucket, while keeping the bucket private.
  api_app:
    type: aws-apigateway:RestAPI
    properties:
      stageName: ${pulumi.stack}
      routes:
        # https://www.pulumi.com/registry/packages/aws-apigateway/api-docs/restapi/#target
        - localPath: ${confFrontendCompiledFilesPath}
          method: GET
          path: /

Output of pulumi about

% pulumi about
CLI          
Version      3.100.0
Go Version   go1.21.5
Go Compiler  gc

Plugins
NAME  VERSION
yaml  unknown

Host     
OS       darwin
Version  13.6.4
Arch     arm64

This project is written in yaml

Additional context

% pulumi plugin ls
NAME            KIND      VERSION  SIZE    INSTALLED    LAST USED
aws             resource  6.13.1   556 MB  1 month ago  1 month ago
aws             resource  6.0.4    536 MB  1 month ago  1 month ago
aws-apigateway  resource  2.1.0    94 MB   1 month ago  1 month ago
aws-apigateway  resource  2.0.1    94 MB   1 month ago  1 month ago
aws-native      resource  0.90.0   92 MB   1 month ago  1 month ago
random          resource  4.15.0   37 MB   1 month ago  1 month ago
str             resource  1.0.0    24 MB   1 month ago  1 month ago
time            resource  0.0.16   38 MB   1 month ago  1 month ago

TOTAL plugin cache size: 1.5 GB

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

mjeffryes commented 8 months ago

Thanks for this report @jamest-pin. This warning is coming from the underlying aws provider.

The deprecation message was fixed in pulumi-aws in Release v6.1.0 · pulumi/pulumi-aws, but pulumi-aws-apigateway just specifies ^6.0.4 for the aws provider version: https://github.com/pulumi/pulumi-aws-apigateway/blob/516c004ea6376febbf9d3a0418cb3ae2b79552c0/provider/cmd/pulumi-resource-aws-apigateway/package.json#L7C1-L7C29 so it's a little tricky to see when pulumi-aws-apigateway should have picked up the change.

I notice that you have multiple versions of both the aws plugin and the aws-apigateway plugin installed though so it's likely your program is just picking out the old version.

You can use pulumi plugin rm to remove the old plugin versions.

If you want to explicitly force the version of the resource from your YAML program - you can do that with the version option:

  api_app:
    type: aws-apigateway:RestAPI
    options:
      version: 2.1.1
    properties:
      stageName: ${pulumi.stack}
      routes:
        # https://www.pulumi.com/registry/packages/aws-apigateway/api-docs/restapi/#target
        - localPath: ${confFrontendCompiledFilesPath}
          method: GET
          path: /
jamest-pin commented 8 months ago

Thank you @mjeffryes. I forgot to mention I'd already tried removing ALL plugins using pulumi plugin rm. It appears to make no difference. It simply redownloads the 6.0.4 version of the aws plugin. I am using yaml thus not specifying the version anywhere. I commented out all instances of version: in the options: block to make sure of this. I also tried destroying my dev stack completely, deleting all plugins, then trying again. It still downloads 6.0.4.

In production, I don't have the liberty of destroying the stack, or even certain resources (such as DNS entries, which cannot be load balanced or blue/greened and take time to propagate). I need a way of

  1. Diagnosing and getting visibility into what's happening
    • I need to see which resource in my stack is requiring a particular version of a plugin
  2. Fixing this without having to recreate resources.

Sorry, I also forgot to mention I have always had the version set (btw, 2.1.0 is the latest for aws-apigateway). I just forgot to include that in my example in the original post. I copied the code from a time where I was testing without setting the version.

options:
      version: 2.1.0

Thanks in advance for your time.

mjeffryes commented 8 months ago

@jamest-pin I realized we have a lockfile pinning the AWS version to v6.0.4; I opened a PR to see if we can bring in a more recent version

jamest-pin commented 8 months ago

Thanks, I did

    options:
      version: 2.2.0

and the warning is gone now.

jamest-pin commented 8 months ago

Minor FYI, the docs page still shows 2.1.0 as being the latest. https://www.pulumi.com/registry/packages/aws-apigateway/api-docs/restapi/