pulumi / pulumi-aws-apigateway

Apache License 2.0
11 stars 5 forks source link

Add support for parsing the schema.yaml to ensure YAML support #49

Closed stack72 closed 2 years ago

stack72 commented 2 years ago

Fixes: #16 Fixes: #19

stack72 commented 2 years ago

The following program:

name: test-aws-apigateway
runtime: yaml
description: A minimal Pulumi YAML program
resources:
  role:
    type: aws:iam:Role
    properties:
      assumeRolePolicy:
        Fn::ToJSON:
          Version: 2012-10-17
          Statement:
            - Action: sts:AssumeRole
              Effect: Allow
              Principal:
                Service: lambda.amazonaws.com
  testPolicy:
    type: aws:iam:RolePolicy
    properties:
      role: ${role.id}
      policy:
        Fn::ToJSON:
          Version: 2012-10-17
          Statement:
            - Action:
                - logs:*
                - cloudwatch:*
              Effect: Allow
              Resource: '*'
  testLambda:
    type: aws:lambda:Function
    properties:
      code:
        Fn::FileArchive: ./handler
      role: ${role.arn}
      handler: handler.handler
      runtime: python3.8
  restApiGw:
    type: aws-apigateway:index:RestAPI
    properties:
      routes:
        - path: "/"
          method: "GET"
          eventHandler: ${testLambda}
outputs:
  endpoint: ${restApiGw.url}

Produces the following output:

View Live: https://app.pulumi.com/stack72/test-aws-apigateway/dev/updates/5

     Type                             Name                     Status
     pulumi:pulumi:Stack              test-aws-apigateway-dev
 +   ├─ aws:iam:RolePolicy            testPolicy               created
 +   ├─ aws:lambda:Function           testLambda               created
 +   └─ aws-apigateway:index:RestAPI  restApiGw                created
 +      ├─ aws:apigateway:RestApi     restApiGw                created
 +      ├─ aws:apigateway:Deployment  restApiGw                created
 +      ├─ aws:lambda:Permission      restApiGw-fa520765       created
 +      └─ aws:apigateway:Stage       restApiGw                created

Outputs:
  + endpoint: "https://66q4q9x9yd.execute-api.us-west-2.amazonaws.com/stage/"

Resources:
    + 7 created
    2 unchanged

Duration: 28s
lukehoban commented 2 years ago

The following program

Should we add this as a test case to lock in this working?

stack72 commented 2 years ago

The following program

Should we add this as a test case to lock in this working?

100% - I am going to be adding more tests here before we make the release!

stack72 commented 2 years ago

The following program

Should we add this as a test case to lock in this working?

100% - I am going to be adding more tests here before we make the release!