Skip to content

Commit

Permalink
feat(core): Pre-concatenate Fn::Join
Browse files Browse the repository at this point in the history
This restores the pre-concatenation of `Fn::Join` fragments that was
introduced in #916 and reverted in #958 due to an other feature part of
the same commit.

The goal is to pre-concatenate the string literals present in the
concatenated values, and flatten `Fn::Join` nested under another
`Fn::Join` using the same delimiter, so as to produce more readable
CloudFormation templates. Additionally, if the `Fn::Join`
pre-concatenation results in a single string being left, then the
`Fn::Join` intrinsic is erased and replaced with a string literal.
  • Loading branch information
RomainMuller committed Oct 18, 2018
1 parent 5bb7c93 commit 82f43f1
Show file tree
Hide file tree
Showing 59 changed files with 902 additions and 1,876 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,11 @@
"Fn::Join": [
"",
[
"arn",
":",
"arn:",
{
"Ref": "AWS::Partition"
},
":",
"s3",
":",
"",
":",
"",
":",
":s3:::",
{
"Ref": "SampleAssetS3BucketE6B2908E"
}
Expand All @@ -52,50 +45,29 @@
"Fn::Join": [
"",
[
"arn:",
{
"Fn::Join": [
"",
[
"arn",
":",
{
"Ref": "AWS::Partition"
},
":",
"s3",
":",
"",
":",
"",
":",
{
"Ref": "SampleAssetS3BucketE6B2908E"
}
]
]
"Ref": "AWS::Partition"
},
":s3:::",
{
"Ref": "SampleAssetS3BucketE6B2908E"
},
"/",
{
"Fn::Join": [
"",
[
{
"Fn::Select": [
0,
{
"Fn::Split": [
"||",
{
"Ref": "SampleAssetS3VersionKey3E106D34"
}
]
}
]
},
"*"
]
"Fn::Select": [
0,
{
"Fn::Split": [
"||",
{
"Ref": "SampleAssetS3VersionKey3E106D34"
}
]
}
]
}
},
"*"
]
]
}
Expand Down
68 changes: 20 additions & 48 deletions packages/@aws-cdk/assets/test/integ.assets.file.lit.expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,11 @@
"Fn::Join": [
"",
[
"arn",
":",
"arn:",
{
"Ref": "AWS::Partition"
},
":",
"s3",
":",
"",
":",
"",
":",
":s3:::",
{
"Ref": "SampleAssetS3BucketE6B2908E"
}
Expand All @@ -52,50 +45,29 @@
"Fn::Join": [
"",
[
"arn:",
{
"Fn::Join": [
"",
[
"arn",
":",
{
"Ref": "AWS::Partition"
},
":",
"s3",
":",
"",
":",
"",
":",
{
"Ref": "SampleAssetS3BucketE6B2908E"
}
]
]
"Ref": "AWS::Partition"
},
":s3:::",
{
"Ref": "SampleAssetS3BucketE6B2908E"
},
"/",
{
"Fn::Join": [
"",
[
{
"Fn::Select": [
0,
{
"Fn::Split": [
"||",
{
"Ref": "SampleAssetS3VersionKey3E106D34"
}
]
}
]
},
"*"
]
"Fn::Select": [
0,
{
"Fn::Split": [
"||",
{
"Ref": "SampleAssetS3VersionKey3E106D34"
}
]
}
]
}
},
"*"
]
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,11 @@
"Fn::Join": [
"",
[
"arn",
":",
"arn:",
{
"Ref": "AWS::Partition"
},
":",
"s3",
":",
"",
":",
"",
":",
":s3:::",
{
"Ref": "MyFileS3BucketACE13C36"
}
Expand All @@ -52,50 +45,29 @@
"Fn::Join": [
"",
[
"arn:",
{
"Fn::Join": [
"",
[
"arn",
":",
{
"Ref": "AWS::Partition"
},
":",
"s3",
":",
"",
":",
"",
":",
{
"Ref": "MyFileS3BucketACE13C36"
}
]
]
"Ref": "AWS::Partition"
},
":s3:::",
{
"Ref": "MyFileS3BucketACE13C36"
},
"/",
{
"Fn::Join": [
"",
[
{
"Fn::Select": [
0,
{
"Fn::Split": [
"||",
{
"Ref": "MyFileS3VersionKey568C3C9F"
}
]
}
]
},
"*"
]
"Fn::Select": [
0,
{
"Fn::Split": [
"||",
{
"Ref": "MyFileS3VersionKey568C3C9F"
}
]
}
]
}
},
"*"
]
]
}
Expand Down
Loading

0 comments on commit 82f43f1

Please sign in to comment.