Skip to content

Commit

Permalink
fix(code): make CfnResource#_toCloudFormation null-safe
Browse files Browse the repository at this point in the history
The `CfnResource#_toCloudFormation` method creates a `PostResolveToken`
with a post-processor that was not ready to handle the absence of
`Properties` on the resolved value. It is however possible that
`Properties` are missing when an object is created with the default
configuration (e.g: by `new sqs.CfnQueue(this, 'Queue');`).

This change makes the post-processor function correctly handle
`undefined` in this case.

Related #3093
  • Loading branch information
RomainMuller committed Jun 28, 2019
1 parent 9a38109 commit 6a5266f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/@aws-cdk/core/lib/cfn-resource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ export class CfnResource extends CfnRefElement {
Metadata: ignoreEmpty(this.cfnOptions.metadata),
Condition: this.cfnOptions.condition && this.cfnOptions.condition.logicalId
}, props => {
props.Properties = this.renderProperties(props.Properties);
props.Properties = props.Properties && this.renderProperties(props.Properties);
return deepMerge(props, this.rawOverrides);
})
}
Expand Down

0 comments on commit 6a5266f

Please sign in to comment.