pulumi / pulumi-aws-apigateway

Apache License 2.0
13 stars 5 forks source link

Unable to consume RestAPI from YAML #19

Closed jkodroff closed 2 years ago

jkodroff commented 2 years ago

This snippet (not minimal - LMK if you need a minimal code sample):

  restApi:
    type: aws-apigateway:index:restAPI
    routes:
      - path: "/"
        method: "GET"
        eventHandler: ${lambda}

Produces this error:

➜  awsx-serverless-yaml pulumi up
Please choose a stack, or create a new one: dev
Previewing update (dev)

View Live: https://app.pulumi.com/jkodroff/awsx-serverless-yaml/dev/previews/edc2420b-5a6d-4e9a-8895-b6487f3a9be5

     Type                 Name                      Plan     Info
     pulumi:pulumi:Stack  awsx-serverless-yaml-dev           2 errors; 4 messages

Diagnostics:
  pulumi:pulumi:Stack (awsx-serverless-yaml-dev):
    Error: error resolving type of resource restApi: internal error loading package "aws-apigateway": <nil>: #/name: no name provided;
      on Pulumi.yaml line 48:
      48:     type: aws-apigateway:index:restAPI
    error resolving type of resource restApi: internal error loading package "aws-apigateway": <nil>: #/name: no name provided;

Was referred to file a bug here by @AaronFriel, so assuming it's not an issue with the Pulumi YAML code.

AaronFriel commented 2 years ago

Oh I think this may be a YAML bug, do you have the full resource declaration? It looks like you might also be missing a properties key.

If this is a YAML bug we'll move it over there.

jkodroff commented 2 years ago

With the properties key:

  restApi:
    type: aws-apigateway:index:restAPI
    properties:
      routes:
        - path: "/"
          method: "GET"
          eventHandler: ${lambda}
Diagnostics:
  pulumi:pulumi:Stack (awsx-serverless-yaml-dev):
    Error: error resolving type of resource restApi: internal error loading package "aws-apigateway": <nil>: #/name: no name provided;
      on Pulumi.yaml line 48:
      48:     type: aws-apigateway:index:restAPI
    error resolving type of resource restApi: internal error loading package "aws-apigateway": <nil>: #/name: no name provided;

    error: Error: error resolving type of resource restApi: internal error loading package "aws-apigateway": <nil>: #/name: no name provided;

      on Pulumi.yaml line 48:
      48:     type: aws-apigateway:index:restAPI

    error resolving type of resource restApi: internal error loading package "aws-apigateway": <nil>: #/name: no name provided;
    error: an unhandled error occurred: failed to evaluate template
AaronFriel commented 2 years ago

This is caused by #16, the provider defined here does not implement GetSchema:

https://github.com/pulumi/pulumi-aws-apigateway/blob/481927a97e00feb783e4f0d8f9f3c34fc795e6be/provider/cmd/pulumi-resource-aws-apigateway/provider.ts#L20-L34