Repository navigation
feat(resolver): resolve ${sls:stage}; aws: refs in fallbacks pass through; filters on resolve-later values error - #83
Merged
Conversation
… through; filters on resolve-later values error
- ${sls:stage} resolves like Serverless (osls get-sls): --stage, else provider.stage, else
'dev'. Other sls: addresses (instanceId) stay unknown-type passthrough.
- Refs the syntax excludes (${aws:...}, ${AWS::...}, ${stageVariables...}) inside another
variable are kept as passthrough, so ${env:X, 'app-${aws:accountId}'} resolves (it blocked
the whole value, even with X set). Outside any variable (IAM ${aws:username}) unchanged.
- A filter over a value still holding an unknown type (${ssm:x}, ${aws:accountId}) throws
instead of silently skipping; known types left unresolved (allowUnresolvedVariables) still skip.
Tests: slsVariables (9), awsInFallback (9); passthroughInFallback uses ${sls:instanceId} as its
unknown type; duplicateVarFallback asserts a var wrapping ${AWS::Region} now resolves to it;
serverlessGoldens regenerated (sls:stage resolved; aws:/instanceId fallback cases added).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
${sls:stage}resolves the way Serverless does (oslsget-sls.js):--stage, elseprovider.stage(a variableprovider.stageresolves through it), else'dev'. Othersls:addresses (instanceId) aren't matched, so they stay unknown-type passthrough. Fixes filters over fallbacks such as${env:X, 'sl-${sls:stage}' | toUpperCase}, which now givesSL-QA.aws:/AWS::refs inside fallbacks. The default syntax excludes${aws:…},${AWS::…}and${stageVariables…}. Nested inside another variable, they stopped that variable from matching at all:${env:X, 'app-${aws:accountId}'}stayed unresolved even withXset. They're now kept as passthroughs in that position. Outside any variable (IAM${aws:username},${aws:PrincipalTag/…}) they're unchanged.${ssm:x},${aws:accountId}) used to be silently skipped; it now throws, naming the filter and the variable. A known type left unresolved underallowUnresolvedVariablesstill skips (the lenient behavior from cfcdac6).Behavior changes in existing tests
passthroughInFallback(fix(resolver): unknown variable types inside a quoted fallback pass through #79) used${sls:stage}as its example unknown type; it now uses${sls:instanceId}.duplicateVarFallback:${opt:nope, ${AWS::Region}, 'us-east-1'}used to stay verbatim (the wrapping var never matched). It now resolves to${AWS::Region}like any fallback list. Plain${AWS::Region}copies are still verbatim.serverlessGoldens:${sls:stage}now shows the resolved stage; newaws:andinstanceIdfallback cases were added.Tests
tests/slsVariables(9) andtests/awsInFallback(9).