Skip to content

Commit 6af9728

Browse files
authored
Merge branch 'main' into aws-pseudo-paramter-docs
2 parents 9d38bb4 + 3103784 commit 6af9728

35 files changed

Lines changed: 982 additions & 273 deletions

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"devDependencies": {
1919
"@types/prettier": "2.6.0",
2020
"@yarnpkg/lockfile": "^1.1.0",
21-
"cdk-generate-synthetic-examples": "^0.1.12",
21+
"cdk-generate-synthetic-examples": "^0.1.14",
2222
"conventional-changelog-cli": "^2.2.2",
2323
"fs-extra": "^9.1.0",
2424
"graceful-fs": "^4.2.10",

packages/@aws-cdk/aws-autoscaling/lib/auto-scaling-group.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,10 @@ export interface CommonAutoScalingGroupProps {
119119
* This is applied when any of the settings on the ASG are changed that
120120
* affect how the instances should be created (VPC, instance type, startup
121121
* scripts, etc.). It indicates how the existing instances should be
122-
* replaced with new instances matching the new config. By default, nothing
123-
* is done and only new instances are launched with the new config.
122+
* replaced with new instances matching the new config. By default,
123+
* `updatePolicy` takes precedence over `updateType`.
124124
*
125-
* @default UpdateType.None
125+
* @default UpdateType.REPLACING_UPDATE, unless updatePolicy has been set
126126
* @deprecated Use `updatePolicy` instead
127127
*/
128128
readonly updateType?: UpdateType;

packages/@aws-cdk/aws-ecs/lib/cluster.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ export class Cluster extends Resource implements ICluster {
338338
const autoScalingGroup = new autoscaling.AutoScalingGroup(this, id, {
339339
vpc: this.vpc,
340340
machineImage,
341-
updateType: options.updateType || autoscaling.UpdateType.REPLACING_UPDATE,
341+
updateType: !!options.updatePolicy ? undefined : options.updateType || autoscaling.UpdateType.REPLACING_UPDATE,
342342
...options,
343343
});
344344

packages/@aws-cdk/aws-ecs/test/cluster.test.ts

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1725,6 +1725,143 @@ describe('cluster', () => {
17251725

17261726
});
17271727

1728+
testDeprecated('updatePolicy set when passed without updateType', () => {
1729+
// GIVEN
1730+
const app = new cdk.App();
1731+
const stack = new cdk.Stack(app, 'test');
1732+
1733+
const cluster = new ecs.Cluster(stack, 'EcsCluster');
1734+
cluster.addCapacity('bottlerocket-asg', {
1735+
instanceType: new ec2.InstanceType('c5.large'),
1736+
machineImage: new ecs.BottleRocketImage(),
1737+
updatePolicy: autoscaling.UpdatePolicy.replacingUpdate(),
1738+
});
1739+
1740+
// THEN
1741+
Template.fromStack(stack).hasResource('AWS::AutoScaling::AutoScalingGroup', {
1742+
UpdatePolicy: {
1743+
AutoScalingReplacingUpdate: {
1744+
WillReplace: true,
1745+
},
1746+
},
1747+
});
1748+
});
1749+
1750+
testDeprecated('undefined updateType & updatePolicy replaced by default updatePolicy', () => {
1751+
// GIVEN
1752+
const app = new cdk.App();
1753+
const stack = new cdk.Stack(app, 'test');
1754+
1755+
const cluster = new ecs.Cluster(stack, 'EcsCluster');
1756+
cluster.addCapacity('bottlerocket-asg', {
1757+
instanceType: new ec2.InstanceType('c5.large'),
1758+
machineImage: new ecs.BottleRocketImage(),
1759+
});
1760+
1761+
// THEN
1762+
Template.fromStack(stack).hasResource('AWS::AutoScaling::AutoScalingGroup', {
1763+
UpdatePolicy: {
1764+
AutoScalingReplacingUpdate: {
1765+
WillReplace: true,
1766+
},
1767+
},
1768+
});
1769+
});
1770+
1771+
testDeprecated('updateType.NONE replaced by updatePolicy equivalent', () => {
1772+
// GIVEN
1773+
const app = new cdk.App();
1774+
const stack = new cdk.Stack(app, 'test');
1775+
1776+
const cluster = new ecs.Cluster(stack, 'EcsCluster');
1777+
cluster.addCapacity('bottlerocket-asg', {
1778+
instanceType: new ec2.InstanceType('c5.large'),
1779+
machineImage: new ecs.BottleRocketImage(),
1780+
updateType: autoscaling.UpdateType.NONE,
1781+
});
1782+
1783+
// THEN
1784+
Template.fromStack(stack).hasResource('AWS::AutoScaling::AutoScalingGroup', {
1785+
UpdatePolicy: {
1786+
AutoScalingScheduledAction: {
1787+
IgnoreUnmodifiedGroupSizeProperties: true,
1788+
},
1789+
},
1790+
});
1791+
});
1792+
1793+
testDeprecated('updateType.REPLACING_UPDATE replaced by updatePolicy equivalent', () => {
1794+
// GIVEN
1795+
const app = new cdk.App();
1796+
const stack = new cdk.Stack(app, 'test');
1797+
1798+
const cluster = new ecs.Cluster(stack, 'EcsCluster');
1799+
cluster.addCapacity('bottlerocket-asg', {
1800+
instanceType: new ec2.InstanceType('c5.large'),
1801+
machineImage: new ecs.BottleRocketImage(),
1802+
updateType: autoscaling.UpdateType.REPLACING_UPDATE,
1803+
});
1804+
1805+
// THEN
1806+
Template.fromStack(stack).hasResource('AWS::AutoScaling::AutoScalingGroup', {
1807+
UpdatePolicy: {
1808+
AutoScalingReplacingUpdate: {
1809+
WillReplace: true,
1810+
},
1811+
},
1812+
});
1813+
});
1814+
1815+
testDeprecated('updateType.ROLLING_UPDATE replaced by updatePolicy equivalent', () => {
1816+
// GIVEN
1817+
const app = new cdk.App();
1818+
const stack = new cdk.Stack(app, 'test');
1819+
1820+
const cluster = new ecs.Cluster(stack, 'EcsCluster');
1821+
cluster.addCapacity('bottlerocket-asg', {
1822+
instanceType: new ec2.InstanceType('c5.large'),
1823+
machineImage: new ecs.BottleRocketImage(),
1824+
updateType: autoscaling.UpdateType.ROLLING_UPDATE,
1825+
});
1826+
1827+
// THEN
1828+
Template.fromStack(stack).hasResource('AWS::AutoScaling::AutoScalingGroup', {
1829+
UpdatePolicy: {
1830+
AutoScalingRollingUpdate: {
1831+
WaitOnResourceSignals: false,
1832+
PauseTime: 'PT0S',
1833+
SuspendProcesses: [
1834+
'HealthCheck',
1835+
'ReplaceUnhealthy',
1836+
'AZRebalance',
1837+
'AlarmNotification',
1838+
'ScheduledActions',
1839+
],
1840+
},
1841+
AutoScalingScheduledAction: {
1842+
IgnoreUnmodifiedGroupSizeProperties: true,
1843+
},
1844+
},
1845+
});
1846+
});
1847+
1848+
testDeprecated('throws when updatePolicy and updateType both specified', () => {
1849+
// GIVEN
1850+
const app = new cdk.App();
1851+
const stack = new cdk.Stack(app, 'test');
1852+
1853+
const cluster = new ecs.Cluster(stack, 'EcsCluster');
1854+
1855+
expect(() => {
1856+
cluster.addCapacity('bottlerocket-asg', {
1857+
instanceType: new ec2.InstanceType('c5.large'),
1858+
machineImage: new ecs.BottleRocketImage(),
1859+
updatePolicy: autoscaling.UpdatePolicy.replacingUpdate(),
1860+
updateType: autoscaling.UpdateType.REPLACING_UPDATE,
1861+
});
1862+
}).toThrow("Cannot set 'signals'/'updatePolicy' and 'updateType' together. Prefer 'signals'/'updatePolicy'");
1863+
});
1864+
17281865
testDeprecated('allows specifying capacityProviders (deprecated)', () => {
17291866
// GIVEN
17301867
const app = new cdk.App();

packages/@aws-cdk/aws-eks/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
"@types/sinon": "^9.0.11",
9191
"@types/yaml": "1.9.6",
9292
"aws-sdk": "^2.848.0",
93-
"cdk8s": "^2.3.72",
93+
"cdk8s": "^2.3.74",
9494
"cdk8s-plus-21": "^2.0.0-beta.12",
9595
"jest": "^27.5.1",
9696
"sinon": "^9.2.4"

packages/@aws-cdk/aws-iotevents-actions/lib/clear-timer-action.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ export class ClearTimerAction implements iotevents.IAction {
1010
*/
1111
constructor(private readonly timerName: string) {}
1212

13-
bind(_scope: Construct, _options: iotevents.ActionBindOptions): iotevents.ActionConfig {
13+
/**
14+
* @internal
15+
*/
16+
public _bind(_scope: Construct, _options: iotevents.ActionBindOptions): iotevents.ActionConfig {
1417
return {
1518
configuration: {
1619
clearTimer: {

packages/@aws-cdk/aws-iotevents-actions/lib/lambda-invoke-action.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ export class LambdaInvokeAction implements iotevents.IAction {
1212
constructor(private readonly func: lambda.IFunction) {
1313
}
1414

15-
bind(_scope: Construct, options: iotevents.ActionBindOptions): iotevents.ActionConfig {
15+
/**
16+
* @internal
17+
*/
18+
public _bind(_scope: Construct, options: iotevents.ActionBindOptions): iotevents.ActionConfig {
1619
this.func.grantInvoke(options.role);
1720
return {
1821
configuration: {

packages/@aws-cdk/aws-iotevents-actions/lib/reset-timer-action.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ export class ResetTimerAction implements iotevents.IAction {
1010
*/
1111
constructor(private readonly timerName: string) {}
1212

13-
bind(_scope: Construct, _options: iotevents.ActionBindOptions): iotevents.ActionConfig {
13+
/**
14+
* @internal
15+
*/
16+
public _bind(_scope: Construct, _options: iotevents.ActionBindOptions): iotevents.ActionConfig {
1417
return {
1518
configuration: {
1619
resetTimer: {

packages/@aws-cdk/aws-iotevents-actions/lib/set-timer-action.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ export class SetTimerAction implements iotevents.IAction {
1616
) {
1717
}
1818

19-
bind(_scope: Construct, _options: iotevents.ActionBindOptions): iotevents.ActionConfig {
19+
/**
20+
* @internal
21+
*/
22+
public _bind(_scope: Construct, _options: iotevents.ActionBindOptions): iotevents.ActionConfig {
2023
return {
2124
configuration: {
2225
setTimer: {

packages/@aws-cdk/aws-iotevents-actions/lib/set-variable-action.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ export class SetVariableAction implements iotevents.IAction {
1212
constructor(private readonly variableName: string, private readonly value: iotevents.Expression) {
1313
}
1414

15-
bind(_scope: Construct, _options: iotevents.ActionBindOptions): iotevents.ActionConfig {
15+
/**
16+
* @internal
17+
*/
18+
public _bind(_scope: Construct, _options: iotevents.ActionBindOptions): iotevents.ActionConfig {
1619
return {
1720
configuration: {
1821
setVariable: {

0 commit comments

Comments
 (0)