When are serverless variables resolved?


When are variables in serverless templates resolved?

I need to generate some of the objects needed for my serverless file as a separate step before deployment(*). So what I’d like to do is use serverless-plugin-scripts to run a script during the “deploy:before:before” step, which generates a JSON file, and then include the JSON using ${file(…)}. Is this possible?

If variables are resolved just-in-time when key values are retrieved, I should be in good shape. If variables are resolved immediately after YAML is loaded, I will have a problem. It seems like JIT evaluation would make the most sense. I.e., why visit the entire YAML tree if you don’t have to?

(*)To be specific, I’m generating DynamoDB CreateTable params from dynogels, and hoping to inject those using ${file(dynogels-tables.json)}. My code base is Typescript, so I can’t use ${file(my-script-which-generates-dynamo-params.js)}