Merge pull request #6624 from serverless/GetAttParserTail

Allow for tail on GetAtt parsing
This commit is contained in:
Philipp Muens 2019-09-03 17:23:57 +02:00 committed by GitHub
commit 573e843b6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -30,7 +30,10 @@ const yamlType = (name, kind) => {
construct: data => {
if (name === 'GetAtt') {
// special GetAtt dot syntax
return { [functionName]: _.isString(data) ? _.split(data, '.', 2) : data };
if (typeof data === 'string') {
const [first, ...tail] = data.split('.');
data = [first, tail.join('.')];
}
}
return { [functionName]: data };
},

View File

@ -19,6 +19,11 @@ const shortHandOptions = [
yaml: 'Item: !GetAtt MyResource.Arn',
json: { Item: { 'Fn::GetAtt': ['MyResource', 'Arn'] } },
},
{
name: 'GetAtt, dot syntax with tail',
yaml: 'Item: !GetAtt MyResource.Outputs.Arn',
json: { Item: { 'Fn::GetAtt': ['MyResource', 'Outputs.Arn'] } },
},
{
name: 'GetAtt, array syntax',
yaml: 'Item: !GetAtt\n- MyResource\n- Arn',