serverless-ide-vscode icon indicating copy to clipboard operation
serverless-ide-vscode copied to clipboard

Unable to include a local file

Open Schachte opened this issue 2 years ago • 1 comments

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 avatar Jan 14 '22 23:01 Schachte

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.

Schachte avatar Jan 14 '22 23:01 Schachte