[Fixed] How to load variables part from custom session, part from file

I can reference the entire file

custom: ${file(../myCustomFile.yml)}

But how can I reference from multiple sources, from both file and variables I define, such as

custom: ${file(../myCustomFile.yml)}
    stack: abc

This doesn’t work.

Assign the contents of your file to a property of custom instead of custom itself.
And stack is indented too far (use 2 spaces instead of 4).
example:

custom:
  private: ${file(../myPrivateProperties.yml)}
  stack: abc

Then you can reference those props later with(example):

provider:
  environment:
    MY_SECRET_PASSWORD: ${self:custom.private.secret-password}
    STACK_NAME: ${self:custom.stack}

Hope that helps.

2 Likes

This really makes sense. Thanks a lot

1 Like