140 Commits

Author SHA1 Message Date
Daniel Schep
c3674e1293 safer & more explicit implementation of variableResolvesrs(also renamed) 2019-08-21 10:22:05 -04:00
Daniel Schep
c0ed311865 simplify variable getter hook system 2019-08-20 15:00:23 -04:00
Daniel Schep
02fa190d0b Add plugin hooks to define config variable getters 2019-08-20 11:23:42 -04:00
Jonathan Keslin
31834261b0 Warn when attempting to split non-StringList parameter type 2019-07-12 09:38:48 -07:00
Jonathan Keslin
96946fd5fc Allow optionally splitting SSM parameter value for StringList type 2019-07-11 15:33:17 -07:00
Mariusz Nowak
e6ae8983de
Fix lint issues after prettification 2019-06-26 12:43:01 +02:00
Mariusz Nowak
4944f471b1
Prettify 2019-06-26 12:43:01 +02:00
Philipp Muens
63c371c057 Turn Serverless Variable into plain value 2019-03-22 10:08:19 +01:00
Philipp Muens
391488bb39 Add ${sls:} Serverless Variable 2019-03-22 10:08:19 +01:00
exoego
616c744bd3 It should return json if referencing JSON in AWS SecretsManager. 2019-02-17 16:49:11 +09:00
Jerry Wang
041f717e07 fix makeDeepVariable replacement 2019-02-07 17:49:35 -05:00
Erik Erikson
f95a99096e Append in Custom Syntax
Respect custom variable syntaxes when appending to deep variables.
2019-02-05 17:11:53 -08:00
exoego
5ed78b8024 Do not remove spaces in single-quote literal. 2019-02-02 22:46:58 +09:00
Eslam λ Hefnawy
8c53de83bf
Merge pull request #5758 from exoego/default-values
AWS: Add fallback support in ${cf} and ${s3}
2019-01-31 15:29:29 +03:00
Daniel Schep
0fb47a1e74 also preresolve keys within credentials 2019-01-29 16:33:08 -05:00
Daniel Schep
b3df0517f1 Require provider.credentials vars to be resolved before s3/ssm/cf vars
Similar to long standing region/stage and new profile preresolve.

test uses the service definition instead of `getCredentials` because
`getCredentials` is much more complex than `getStage`/`getProfile`/`getRegion`
and we only need to test that the config is updated, not all the
credential setting logic
2019-01-29 13:56:59 -05:00
exoego
b67d9ca03c Support default value if ${s3} and ${cf} failed. 2019-01-27 17:00:22 +09:00
Daniel Schep
e1f9b83dc9 resolve vars in file profile config before ssm vars 2019-01-25 08:24:15 -05:00
exoego
cec6d5501b Suppress confusing warning since root cause is warned elsewhere. 2019-01-19 07:20:49 +09:00
exoego
f434009c45 Move stage name validation to Service#validate.
Since validation should be performed after service.functions are resolved.
2019-01-16 16:39:09 +09:00
Daniel Schep
96906c1c70
Merge pull request #5686 from exoego/validation-after-var-resolution
AWS: Fix stage name validation timing and allow hyphen
2019-01-13 20:25:53 -05:00
exoego
fe6cb01302 Fix error message. 2019-01-12 17:33:38 +09:00
exoego
df780c36e3 Allow underscore too. 2019-01-12 17:17:40 +09:00
exoego
a12bb5bf71 Allow hyphen which is valid for API Gateway now. 2019-01-12 08:53:29 +09:00
exoego
6e0d7a86d1 Implement after-variable-resolution stage name validation for AWS. 2019-01-12 08:11:50 +09:00
Daniel Schep
0896f311b1
Merge pull request #5312 from Limess/4496/handle-scoped-packages
Handle scoped npm packages in ${file()} variables
2019-01-07 10:56:25 -05:00
Daniel Schep
e99e71d215 lint 2018-12-13 09:32:46 -05:00
Daniel Schep
63fb1309d3 restore support for variable refs with spaces in them 2018-12-13 09:16:57 -05:00
horike37
4336340aa4 Merge remote-tracking branch 'root/master' into cf-ref-region 2018-12-10 12:01:41 +09:00
exoego
13de2a9083 Use lodash for consistency. 2018-12-10 09:50:16 +09:00
exoego
e90e293c71 Add region suffix support to CloudFormation reference syntax 2018-12-08 20:44:16 +09:00
exoego
1a9cdf356b Remove whitespace-celaning that seems unnecessary. 2018-12-06 21:36:00 +09:00
Charlie Briggs
8f8c27ae7e Handle scoped packages in ${file()} variables
Currently @ is not a valid variable character, so it doesn't get parsed
as one.
When it does get parsed, @ is not considered valid as part of a file path
- we add a blacklist as per https://github.com/serverless/serverless/pull/4528 to
handle this case.
2018-09-19 17:26:50 +01:00
Erik Erikson
2ebc65fe97 Fix Embedded Deep Variable in Variable String, within Override bug
If an override comes back as a variable containing a deep variable (e.g. `''${self:custom.${deep:1}, "fallback"}''`) or really any variable at all, it needs to be made a deep variable and paused for next iteration.  Do this generally rather than only in the case of deep variables.  See the test case for a circumstance that the prior fix didn't resolve.  This more generalized handling improves the fix and solves a remaining issue we found locally.
2018-08-17 17:50:58 -07:00
Erik Erikson
73ebe0f66b Fix #5205
Use the variable string from which the overwrite parameters were extracted as the replacement target (in the case of deep variable discovery) rather than the context property which represents the entire original value that the replacement is being waited upon.  That context property can contain far more content than the overwrite string itself.
2018-08-16 18:35:53 -07:00
Takahiro Horike
659df3651c
Merge pull request #5119 from gcphost/master
#5110 null error on undefined AWS SSM variables
2018-08-06 21:31:57 +09:00
Erik Erikson
42d1749c36 When evaluating overwrite values, identify deep values and pause population.
This avoids taking a deep value as a valid term within an overwrite 
(defaulting) variable statement that will later resolve to undefined 
but, as a deep variable string, is valid in immediate evaluation.

Fixes #5027
2018-07-24 14:42:21 -07:00
William
0f1c8047da Use statusCode for comparison, update tests to provide correct statusCode. 2018-07-16 21:51:02 -07:00
William
58c8352ec2
Switch to lodash get. 2018-07-16 20:54:30 -07:00
William
20401e7c3c
Remove extra space 2018-07-12 21:37:11 -07:00
William
2d6248f08b
Remove additional space 2018-07-12 14:26:02 -07:00
William
849d3b206f
Change error detection
Use code provided by the errors providerError.
2018-07-12 14:24:56 -07:00
William
880ba0b788
#5110 null error on undefined SSM variables
Ignore null errors to allow resolution instead of rejection on undefined SSM variables.
2018-07-11 08:44:58 -07:00
Erik Erikson
534dda6285 Fix #4973
Do a better job of extracting the current variable syntax for use in deep variable generation.
2018-05-18 00:04:37 -07:00
Erik Erikson
63045fd206 Fix #4946
Use the variable syntax present in the given variable string, extracting it from the given string that may contain embedded custom variables (i.e. `${{self:var.${{self:var.foo}}.bar}}`).
2018-05-02 11:52:24 -07:00
Takahiro Horike
a9e6a79d01
Merge pull request #4743 from svdgraaf/feature/pass-serverless-variable
Pass serverless variable when calling function in referenced file
2018-04-03 05:04:08 +09:00
Erik Erikson
71c6db9687 Re-write self:service.[...] to self:serviceObject.[...]
Handle `self:service.[...]` references properly.  The prior represents what the user typed into their configuration.  In service, we move all this from `service` to `serviceObject`, therefore, by rewriting `self:service.[...]` to `self:serviceObject.[...]` user's will get the result they expect.
Use else if, given exclusivity of conditions
2018-03-27 15:34:34 -07:00
Frank Schmid
5a4d00c9ad
Merge pull request #4800 from bsdkurt/master
Continue recursion for #4687
2018-03-06 11:35:17 +01:00
Kurt Miller
3f5a041678 Continue recursion for #4687 2018-03-04 08:25:19 -05:00
Erik Erikson
0ee0a1e239 Only disable and restore dependent service resolution methods once. Otherwise, subsequent removals may cache the previous replacements. If they restore last then they will restore with the replacements, breaking standard usage.
Add tests for this guarantee.
2018-02-24 09:34:50 -08:00