Open hbarcelos opened 3 years ago
I am observing the same issue:
custom:
paramstage: ${self:provider.stage}
serverlessIfElse:
- If: '"${opt:stage, self:provider.stage}" == "local"'
Set:
custom.paramstage: 'dev'
ElseSet:
custom.paramstage: ${self:provider.stage}
which when printed resolves correctly, however, the values are not applied to custom.paramstage and the end result is that the value of the custom.paramstage is always it was initially set to
paramstage: local
serverlessIfElse:
- If: '"local" == "local"'
Set:
custom.paramstage: dev
ElseSet:
custom.paramstage: local
I've found that environment variables cannot be evaluated by this plugin.
This check to see if an envar is set fails:
custom:
serverlessIfElse:
- If: '"${env:CI_NAME}" != ""'
Set:
provider.tags.CI: true
But leaning the check up against a native sls property that evaluates envars works:
provider:
tags:
CI_NAME: ${env:CI_NAME, 'na'}
...
serverlessIfElse:
- If: '"${self:provider.tags.CI_NAME}" != "na"'
Set:
provider.tags.CI: true
So I'm getting what I need atm anyhow, but it would be nice not to have to rely on another property to shim this functionality.
I'm combining the use of this plugin with
serverless-dotenv-plugin
.ifelse
is declared AFTERdotenv
:Then I have the following:
Even though the following line is logged when I run
serverless deploy
,the stack created use
kovan
as the value set, as the CloudFormation template contains things like:So basically even though the plugin says it changed the
stage
value, it has no effect.