You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(cli): externally managed stack notification arns are deleted on deploy (#32163)
Closes#32153.
### Reason for this change
When a stack contains externally managed notification ARNs (i.e ones that were added outside of CDK), a `cdk deploy` command will remove those ARNs.
### Description of changes
We incorrectly default notification ARNs to `[]` instead of `undefined`. When an empty array is passed to the SDK , it reasonably assumes you want to delete existing ARNs (because how otherwise would you delete them). If on the other hand you don't pass notification ARNs at all to the SDK (e.g `undefined`), it will preserve them.
This is the correct behavior and CDK should follow suite. This does however create a (maybe) quirky API ergonomic where in order to remove notification ARNs, one must pass `[]` instead of simply omitting the property.
This stems from the fact notification ARNs are not managed through the template, but rather through imperative actions. So it seems reasonable al things considered.
### Description of how you validated changes
Added both unit and integration tests.
### Checklist
- [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)
----
*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
'require-approval': {type: 'string',choices: [RequireApproval.Never,RequireApproval.AnyChange,RequireApproval.Broadening],desc: 'What security-sensitive changes need manual approval'},
115
-
'notification-arns': {type: 'array',desc: 'ARNs of SNS topics that CloudFormation will notify with stack related events',nargs: 1,requiresArg: true},
115
+
'notification-arns': {type: 'array',desc: 'ARNs of SNS topics that CloudFormation will notify with stack related events. These will be added to ARNs specified with the \'notificationArns\' stack property.',nargs: 1,requiresArg: true},
116
116
// @deprecated(v2) -- tags are part of the Cloud Assembly and tags specified here will be overwritten on the next deployment
117
117
'tags': {type: 'array',alias: 't',desc: 'Tags to add to the stack (KEY=VALUE), overrides tags from Cloud Assembly (deprecated)',nargs: 1,requiresArg: true},
118
118
'execute': {type: 'boolean',desc: 'Whether to execute ChangeSet (--no-execute will NOT execute the ChangeSet) (deprecated)',deprecated: true},
Copy file name to clipboardExpand all lines: packages/aws-cdk/lib/parse-command-line-arguments.ts
+1-1
Original file line number
Diff line number
Diff line change
@@ -355,7 +355,7 @@ export function parseCommandLineArguments(
355
355
})
356
356
.option('notification-arns',{
357
357
type: 'array',
358
-
desc: 'ARNs of SNS topics that CloudFormation will notify with stack related events',
358
+
desc: "ARNs of SNS topics that CloudFormation will notify with stack related events. These will be added to ARNs specified with the 'notificationArns' stack property.",
0 commit comments