Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cloudformation-include): string arrays inside unknown properties cannot be parsed #32461

Merged
merged 5 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,17 +1,32 @@
{
"AWSTemplateFormatVersion": "2010-09-09",
"Resources": {
"ASG": {
"AutoScalingGroup": {
"Type": "AWS::AutoScaling::AutoScalingGroup",
"Properties": {
"DesiredCapacity": "1",
"MinSize": "1",
"MaxSize": "5"
},
"CreationPolicy": {
"NonExistentResourceAttribute": "Bucket1"
"ResourceSignal": {
"Count": 1,
"Timeout": "PT10M"
}
Copy link
Contributor

@rix0rrr rix0rrr Dec 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we renaming properties in a file called non-existent-policy-attribute.json away from a nonexistent name to a recognized name? This looks like it's removing a test for a specific behavior.

},
"UpdatePolicy": {
"NonExistentResourceAttribute": "Bucket1"
"AutoScalingRollingUpdate": {
"PauseTime": "PT10M",
"SuspendProcesses": [
"HealthCheck",
"ReplaceUnhealthy",
"AZRebalance",
"AlarmNotification",
"ScheduledActions"
],
"WaitOnResourceSignals": true
}
}
}
}
}
}
8 changes: 4 additions & 4 deletions packages/aws-cdk-lib/core/lib/helpers-internal/cfn-parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ export class FromCloudFormation {
}

// in all other cases, delegate to the standard mapping logic
return this.getArray(this.getString)(value);
return FromCloudFormation.getArray(FromCloudFormation.getString)(value);
}

public static getArray<T>(mapper: (arg: any) => FromCloudFormationResult<T>): (x: any) => FromCloudFormationResult<T[]> {
Expand Down Expand Up @@ -233,7 +233,7 @@ export class FromCloudFormation {
* Return a function that, when applied to a value, will return the first validly deserialized one
*/
public static getTypeUnion(validators: Validator[], mappers: Array<(x: any) => FromCloudFormationResult<any>>):
(x: any) => FromCloudFormationResult<any> {
(x: any) => FromCloudFormationResult<any> {
return (value: any) => {
for (let i = 0; i < validators.length; i++) {
const candidate = mappers[i](value);
Expand Down Expand Up @@ -716,8 +716,8 @@ export class CfnParser {

const key = objectKeys[0];
return key === 'Ref' || key.startsWith('Fn::') ||
// special intrinsic only available in the 'Conditions' section
(this.options.context === CfnParsingContext.CONDITIONS && key === 'Condition')
// special intrinsic only available in the 'Conditions' section
(this.options.context === CfnParsingContext.CONDITIONS && key === 'Condition')
? key
: undefined;
}
Expand Down
Loading