serverless-plugin-ifelse
serverless-plugin-ifelse copied to clipboard
Can Plugin Set custom Variables?
trafficstars
Been experimenting, and it looks like this most useful plugin can target a section of serverless.yml like a provider, but cannot set the value of a custom variable, e.g.
serverlessIfElse:
- If: '"${self:custom.somevalue}" == "true"'
Set:
self:custom.targetValue: somevalue
ElseSet:
self:custom.targetValue: someOthervalue
Tried a few syntactic variants with $ and brackets, without effect
Is it indeed not possible to set a conditional custom variable this way? Works great targeting a provider, though :)
I did use it to update the custom variable value and it worked for me.
I'd the following:
custom:
dynamodb:
start:
dbPath: "somePath/"
and then I used the following and it worked for my case.
serverlessIfElse:
- If: '"${self:custom.ENV.IS_OFFLINE}" == "1"'
Set:
custom.dynamodb.start.dbPath: "someOtherPath/"
From my experience using serverlessIfElse to set custom vars, specially those that are in the config of another plugin does not work.