serverless / template

Compose & provision a collection of Serverless Components
https://serverless.com
Apache License 2.0
10 stars 6 forks source link

resolveTemplate transforms arrays into objects #1

Open bboure opened 5 years ago

bboure commented 5 years ago

Hi,

I am trying to build my own component and after looking at some examples, I tried the "new way" of doing it (using @serverless/core and @serverless/cli). I understand this is still experimental (I can tell by the age of this repo), but I gave it a shot anyway. In my progress I hit a first issue:

Here, my template which contains an array, gets transformed into an object.

...
accessPolicies:
      Version: "2012-10-17"
      Statement:
        - Effect: Allow
          Principal:
            AWS: "*"
          Action:
            - es:*
          Resource: "*"

becomes

...
{
    "accessPolicies": {
        "Version": "2012-10-17",
        "Statement": {
            "0": {
                "Effect": "Allow",
                "Principal": {
                    "AWS": "*"
                },
                "Action": {
                    "0": "es:*"
                },
                "Resource": "*"
            }
        }
    }
}

This causes the API call to AWS to fail because it is expecting an array.