threadheap / serverless-ide-vscode

Serverless IDE: Enhanced support for AWS SAM and CloudFormation in VS Code
https://serverless-ide.com/
195 stars 45 forks source link

Unable to include a local file #150

Open Schachte opened 2 years ago

Schachte commented 2 years ago

I'm running into the following issue trying to import a local file:

resources:
    - ${file(resources/dynamo/UsersSubscriptionTable.yml):UsersSubscriptionTable}

The linter isn't liking this format. What could I be missing? I've tried a dozen different combinations of this.

Adjacent file:

  UsersSubscriptionTable:
    Type: AWS::DynamoDB::Table
    Properties:
      TableName: MyCoolTable
      BillingMode: PAY_PER_REQUEST
      AttributeDefinitions: 
        - AttributeName: email
          AttributeType: S

      # Specifies the email as the partition key (primary key)
      KeySchema:
        - AttributeName: email
          KeyType: HASH

image

image

Schachte commented 2 years ago

Looks like I see what's going on. I need the resources object to have a key referencing the logical name of the resource I'm referencing:

resources:
  Resources:
    UsersSubscriptionTable: ${file(resources/dynamo/UsersSubscriptionTable.yml):UsersSubscriptionTable}

It's valid under serverless framework, but not the ide plugin:

image

Curious if there is a cleaner way. I don't really foresee super needing this, but was frustrating to debug.