File tree 2 files changed +11
-2
lines changed
2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -191,6 +191,7 @@ export class Resource extends Referenceable {
191
191
DependsOn : ignoreEmpty ( this , this . renderDependsOn ( ) ) ,
192
192
CreationPolicy : capitalizePropertyNames ( this , this . options . creationPolicy ) ,
193
193
UpdatePolicy : capitalizePropertyNames ( this , this . options . updatePolicy ) ,
194
+ UpdateReplacePolicy : capitalizePropertyNames ( this , this . options . updateReplacePolicy ) ,
194
195
DeletionPolicy : capitalizePropertyNames ( this , this . options . deletionPolicy ) ,
195
196
Metadata : ignoreEmpty ( this , this . options . metadata ) ,
196
197
Condition : this . options . condition && this . options . condition . logicalId
@@ -270,6 +271,12 @@ export interface ResourceOptions {
270
271
*/
271
272
updatePolicy ?: UpdatePolicy ;
272
273
274
+ /**
275
+ * Use the UpdateReplacePolicy attribute to retain or (in some cases) backup the existing physical instance of a resource
276
+ * when it is replaced during a stack update operation.
277
+ */
278
+ updateReplacePolicy ?: DeletionPolicy ;
279
+
273
280
/**
274
281
* Metadata associated with the CloudFormation resource. This is not the same as the construct metadata which can be added
275
282
* using construct.addMetadata(), but would not appear in the CloudFormation template automatically.
Original file line number Diff line number Diff line change @@ -165,7 +165,7 @@ export = {
165
165
test . done ( ) ;
166
166
} ,
167
167
168
- 'creation/update/deletion policies can be set on a resource' ( test : Test ) {
168
+ 'creation/update/updateReplace/ deletion policies can be set on a resource' ( test : Test ) {
169
169
const stack = new Stack ( ) ;
170
170
const r1 = new Resource ( stack , 'Resource' , { type : 'Type' } ) ;
171
171
@@ -181,6 +181,7 @@ export = {
181
181
} ,
182
182
} ;
183
183
r1 . options . deletionPolicy = DeletionPolicy . Retain ;
184
+ r1 . options . updateReplacePolicy = DeletionPolicy . Snapshot ;
184
185
185
186
test . deepEqual ( stack . toCloudFormation ( ) , {
186
187
Resources : {
@@ -196,7 +197,8 @@ export = {
196
197
BeforeAllowTrafficHook : 'lambda1' ,
197
198
} ,
198
199
} ,
199
- DeletionPolicy : 'Retain'
200
+ DeletionPolicy : 'Retain' ,
201
+ UpdateReplacePolicy : 'Snapshot'
200
202
}
201
203
}
202
204
} ) ;
You can’t perform that action at this time.
0 commit comments