Skip to content

Commit 56f0b4e

Browse files
ZeldoKaviraElad Ben-Israel
authored and
Elad Ben-Israel
committed
feat(cdk): Add support for UseOnlineResharding with UpdatePolicies (#881)
1 parent bba3602 commit 56f0b4e

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

Diff for: packages/@aws-cdk/cdk/lib/cloudformation/resource-policy.ts

+6
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,12 @@ export interface UpdatePolicy {
124124
*/
125125
autoScalingScheduledAction?: AutoScalingScheduledAction;
126126

127+
/**
128+
* To modify a replication group's shards by adding or removing shards, rather than replacing the entire
129+
* AWS::ElastiCache::ReplicationGroup resource, use the UseOnlineResharding update policy.
130+
*/
131+
useOnlineResharding?: boolean;
132+
127133
}
128134

129135
/**

Diff for: packages/@aws-cdk/cdk/test/cloudformation/test.resource.ts

+22-2
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ export = {
170170

171171
r1.options.creationPolicy = { autoScalingCreationPolicy: { minSuccessfulInstancesPercent: 10 } };
172172
// tslint:disable-next-line:max-line-length
173-
r1.options.updatePolicy = { autoScalingScheduledAction: { ignoreUnmodifiedGroupSizeProperties: false }, autoScalingReplacingUpdate: { willReplace: true } };
173+
r1.options.updatePolicy = { autoScalingScheduledAction: { ignoreUnmodifiedGroupSizeProperties: false }, autoScalingReplacingUpdate: { willReplace: true }};
174174
r1.options.deletionPolicy = DeletionPolicy.Retain;
175175

176176
test.deepEqual(stack.toCloudFormation(), {
@@ -180,7 +180,7 @@ export = {
180180
CreationPolicy: { AutoScalingCreationPolicy: { MinSuccessfulInstancesPercent: 10 } },
181181
UpdatePolicy: {
182182
AutoScalingScheduledAction: { IgnoreUnmodifiedGroupSizeProperties: false },
183-
AutoScalingReplacingUpdate: { WillReplace: true }
183+
AutoScalingReplacingUpdate: { WillReplace: true },
184184
},
185185
DeletionPolicy: 'Retain'
186186
}
@@ -190,6 +190,26 @@ export = {
190190
test.done();
191191
},
192192

193+
'update policies UseOnlineResharding flag'(test: Test) {
194+
const stack = new Stack();
195+
const r1 = new Resource(stack, 'Resource', { type: 'Type' });
196+
197+
r1.options.updatePolicy = { useOnlineResharding: true };
198+
199+
test.deepEqual(stack.toCloudFormation(), {
200+
Resources: {
201+
Resource: {
202+
Type: 'Type',
203+
UpdatePolicy: {
204+
UseOnlineResharding: true,
205+
},
206+
}
207+
}
208+
});
209+
210+
test.done();
211+
},
212+
193213
'metadata can be set on a resource'(test: Test) {
194214
const stack = new Stack();
195215
const r1 = new Resource(stack, 'Resource', { type: 'Type' });

0 commit comments

Comments
 (0)