Skip to content

Commit 0263467

Browse files
authored
Add ConcurrencyMode Support for StackSet Resource (#123)
1 parent 606d9a2 commit 0263467

File tree

11 files changed

+46
-16
lines changed

11 files changed

+46
-16
lines changed

aws-cloudformation-hookdefaultversion/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
<dependency>
3636
<groupId>software.amazon.cloudformation</groupId>
3737
<artifactId>aws-cloudformation-rpdk-java-plugin</artifactId>
38-
<version>[2.0.0, 3.0.0)</version>
38+
<version>[2.0.0, 2.1.0)</version>
3939
</dependency>
4040
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
4141
<dependency>

aws-cloudformation-hooktypeconfig/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
<dependency>
3636
<groupId>software.amazon.cloudformation</groupId>
3737
<artifactId>aws-cloudformation-rpdk-java-plugin</artifactId>
38-
<version>[2.0.0, 3.0.0)</version>
38+
<version>[2.0.0, 2.1.0)</version>
3939
</dependency>
4040
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
4141
<dependency>

aws-cloudformation-hookversion/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
<dependency>
3636
<groupId>software.amazon.cloudformation</groupId>
3737
<artifactId>aws-cloudformation-rpdk-java-plugin</artifactId>
38-
<version>[2.0.0,3.0.0)</version>
38+
<version>[2.0.0,2.1.0)</version>
3939
</dependency>
4040
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
4141
<dependency>

aws-cloudformation-stack/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
<dependency>
3131
<groupId>software.amazon.cloudformation</groupId>
3232
<artifactId>aws-cloudformation-rpdk-java-plugin</artifactId>
33-
<version>[2.0.0,3.0.0)</version>
33+
<version>[2.0.0,2.1.0)</version>
3434
</dependency>
3535
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
3636
<dependency>

aws-cloudformation-stackset/aws-cloudformation-stackset.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,14 @@
7676
"PARALLEL"
7777
]
7878
},
79+
"ConcurrencyMode": {
80+
"description": "Specifies how the concurrency level behaves during the operation execution.",
81+
"type": "string",
82+
"enum": [
83+
"STRICT_FAILURE_TOLERANCE",
84+
"SOFT_FAILURE_TOLERANCE"
85+
]
86+
},
7987
"Active": {
8088
"description": "When true, StackSets performs non-conflicting operations concurrently and queues conflicting operations. After conflicting operations finish, StackSets starts queued operations in request order.",
8189
"type": "boolean"
@@ -110,6 +118,9 @@
110118
},
111119
"RegionConcurrencyType": {
112120
"$ref": "#/definitions/RegionConcurrencyType"
121+
},
122+
"ConcurrencyMode": {
123+
"$ref": "#/definitions/ConcurrencyMode"
113124
}
114125
},
115126
"additionalProperties": false

aws-cloudformation-stackset/docs/operationpreferences.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ To declare this entity in your AWS CloudFormation template, use the following sy
1515
"<a href="#maxconcurrentcount" title="MaxConcurrentCount">MaxConcurrentCount</a>" : <i>Integer</i>,
1616
"<a href="#maxconcurrentpercentage" title="MaxConcurrentPercentage">MaxConcurrentPercentage</a>" : <i>Integer</i>,
1717
"<a href="#regionorder" title="RegionOrder">RegionOrder</a>" : <i>[ String, ... ]</i>,
18-
"<a href="#regionconcurrencytype" title="RegionConcurrencyType">RegionConcurrencyType</a>" : <i>String</i>
18+
"<a href="#regionconcurrencytype" title="RegionConcurrencyType">RegionConcurrencyType</a>" : <i>String</i>,
19+
"<a href="#concurrencymode" title="ConcurrencyMode">ConcurrencyMode</a>" : <i>String</i>
1920
}
2021
</pre>
2122

@@ -29,6 +30,7 @@ To declare this entity in your AWS CloudFormation template, use the following sy
2930
<a href="#regionorder" title="RegionOrder">RegionOrder</a>: <i>
3031
- String</i>
3132
<a href="#regionconcurrencytype" title="RegionConcurrencyType">RegionConcurrencyType</a>: <i>String</i>
33+
<a href="#concurrencymode" title="ConcurrencyMode">ConcurrencyMode</a>: <i>String</i>
3234
</pre>
3335

3436
## Properties
@@ -84,3 +86,15 @@ _Type_: String
8486
_Allowed Values_: <code>SEQUENTIAL</code> | <code>PARALLEL</code>
8587

8688
_Update requires_: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)
89+
90+
#### ConcurrencyMode
91+
92+
Specifies how the concurrency level behaves during the operation execution.
93+
94+
_Required_: No
95+
96+
_Type_: String
97+
98+
_Allowed Values_: <code>STRICT_FAILURE_TOLERANCE</code> | <code>SOFT_FAILURE_TOLERANCE</code>
99+
100+
_Update requires_: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

aws-cloudformation-stackset/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<dependency>
2525
<groupId>software.amazon.awssdk</groupId>
2626
<artifactId>bom</artifactId>
27-
<version>2.17.235</version>
27+
<version>2.25.51</version>
2828
<type>pom</type>
2929
<scope>import</scope>
3030
</dependency>
@@ -49,7 +49,7 @@
4949
<groupId>software.amazon.awssdk</groupId>
5050
<artifactId>cloudformation</artifactId>
5151
<!-- Specify the version id so we can install local sdk -->
52-
<version>2.17.235</version>
52+
<version>2.25.51</version>
5353
</dependency>
5454
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
5555
<dependency>

aws-cloudformation-stackset/src/main/java/software/amazon/cloudformation/stackset/translator/PropertyTranslator.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ static StackSetOperationPreferences translateToSdkOperationPreferences(
118118
.failureTolerancePercentage(operationPreferences.getFailureTolerancePercentage())
119119
.regionOrder(operationPreferences.getRegionOrder())
120120
.regionConcurrencyType(operationPreferences.getRegionConcurrencyType())
121+
.concurrencyMode(operationPreferences.getConcurrencyMode())
121122
.build();
122123
}
123124

aws-cloudformation-stackset/src/test/java/software/amazon/cloudformation/stackset/translator/PropertyTranslatorTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import java.util.HashSet;
44
import org.junit.jupiter.api.Test;
5+
import software.amazon.awssdk.services.cloudformation.model.ConcurrencyMode;
56
import software.amazon.awssdk.services.cloudformation.model.DeploymentTargets;
67
import software.amazon.awssdk.services.cloudformation.model.RegionConcurrencyType;
78
import software.amazon.awssdk.services.cloudformation.model.StackSetOperationPreferences;
@@ -73,6 +74,7 @@ public void test_translateToStackSetOperationPreferences() {
7374
assertThat(stackSetOperationPreferences.maxConcurrentPercentage()).isEqualTo(100);
7475
assertThat(stackSetOperationPreferences.regionOrder()).isEqualTo(Arrays.asList(TestUtils.US_WEST_1, TestUtils.US_EAST_1));
7576
assertThat(stackSetOperationPreferences.regionConcurrencyType()).isEqualTo(RegionConcurrencyType.PARALLEL);
77+
assertThat(stackSetOperationPreferences.concurrencyMode()).isEqualTo(ConcurrencyMode.STRICT_FAILURE_TOLERANCE);
7678
}
7779

7880
@Test

aws-cloudformation-stackset/src/test/java/software/amazon/cloudformation/stackset/util/AltResourceModelAnalyzerTest.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ public void test_ALT_Create_With_OperationPreferences_And_Region_Order() {
168168
new HashSet<>(Arrays.asList(region_1, region_2, region_3)))
169169
)));
170170
List<String> regionOrder = Arrays.asList(region_3, region_2, region_1);
171-
currentModel.setOperationPreferences(new OperationPreferences(null, null, null, null, regionOrder, null));
171+
currentModel.setOperationPreferences(new OperationPreferences(null, null, null, null, regionOrder, null, null));
172172

173173
Set<StackInstances> desiredDeleteInstances = new LinkedHashSet<>();
174174
Set<StackInstances> desiredCreateInstances = new LinkedHashSet<>(Arrays.asList(
@@ -199,7 +199,7 @@ public void test_ALT_Create_With_OperationPreferences_And_Region_Order_And_ME()
199199
new HashSet<>(Arrays.asList(region_1, region_2, region_3)))
200200
)));
201201
List<String> regionOrder = Arrays.asList(region_3, region_2, region_1);
202-
currentModel.setOperationPreferences(new OperationPreferences(null, null, null, null, regionOrder, null));
202+
currentModel.setOperationPreferences(new OperationPreferences(null, null, null, null, regionOrder, null, null));
203203
currentModel.setManagedExecution(new ManagedExecution(true));
204204

205205
Set<StackInstances> desiredDeleteInstances = new LinkedHashSet<>();
@@ -231,7 +231,7 @@ public void test_ALT_Create_With_Less_Number_Of_Regions_In_Region_Order() {
231231
new HashSet<>(Arrays.asList(region_1, region_2, region_3)))
232232
)));
233233
List<String> regionOrder = Arrays.asList(region_3);
234-
currentModel.setOperationPreferences(new OperationPreferences(null, null, null, null, regionOrder, null));
234+
currentModel.setOperationPreferences(new OperationPreferences(null, null, null, null, regionOrder, null, null));
235235

236236
Set<StackInstances> desiredDeleteInstances = new LinkedHashSet<>();
237237
Set<StackInstances> desiredCreateInstances = new LinkedHashSet<>(Arrays.asList(
@@ -261,7 +261,7 @@ public void test_ALT_Create_With_InCorrect_Region_Order() {
261261
new HashSet<>(Arrays.asList(region_1, region_2)))
262262
)));
263263
List<String> regionOrder = Arrays.asList(region_3);
264-
currentModel.setOperationPreferences(new OperationPreferences(null, null, null, null, regionOrder, null));
264+
currentModel.setOperationPreferences(new OperationPreferences(null, null, null, null, regionOrder, null, null));
265265

266266
Set<StackInstances> desiredDeleteInstances = new LinkedHashSet<>();
267267
Set<StackInstances> desiredCreateInstances = new LinkedHashSet<>(Arrays.asList(
@@ -291,7 +291,7 @@ public void test_ALT_Create_With_Less_Number_Of_Regions() {
291291
new HashSet<>(Arrays.asList(region_1, region_2)))
292292
)));
293293
List<String> regionOrder = Arrays.asList(region_3, region_2, region_1);
294-
currentModel.setOperationPreferences(new OperationPreferences(null, null, null, null, regionOrder, null));
294+
currentModel.setOperationPreferences(new OperationPreferences(null, null, null, null, regionOrder, null, null));
295295

296296
Set<StackInstances> desiredDeleteInstances = new LinkedHashSet<>();
297297
Set<StackInstances> desiredCreateInstances = new LinkedHashSet<>(Arrays.asList(
@@ -321,7 +321,7 @@ public void test_ALT_Delete_With_OperationPreferences_And_Region_Order() {
321321
new HashSet<>(Arrays.asList(region_1, region_2, region_3)))
322322
)));
323323
List<String> regionOrder = Arrays.asList(region_3, region_2, region_1);
324-
previousModel.setOperationPreferences(new OperationPreferences(null, null, null, null, regionOrder, null));
324+
previousModel.setOperationPreferences(new OperationPreferences(null, null, null, null, regionOrder, null, null));
325325

326326
Set<StackInstances> desiredDeleteInstances = new LinkedHashSet<>(Arrays.asList(
327327
generateInstancesWithRegions(Arrays.asList(OU_2, OU_3), Arrays.asList(account_1, account_2), INTER, region_3),
@@ -376,7 +376,7 @@ public void test_ALT_Create_With_Null_Region_Order_And_Not_Null_OperationPrefere
376376
Arrays.asList(OU_2, OU_3), Arrays.asList(account_1, account_2), INTER,
377377
new HashSet<>(Arrays.asList(region_1, region_2, region_3)))
378378
)));
379-
currentModel.setOperationPreferences(new OperationPreferences(null, null, null, null, null, null));
379+
currentModel.setOperationPreferences(new OperationPreferences(null, null, null, null, null, null, null));
380380

381381
Set<StackInstances> desiredDeleteInstances = new LinkedHashSet<>();
382382
Set<StackInstances> desiredCreateInstances = new LinkedHashSet<>(Arrays.asList(
@@ -401,7 +401,7 @@ public void test_ALT_Delete_With_Null_Region_Order_And_Not_Null_OperationPrefere
401401
Arrays.asList(OU_2, OU_3), Arrays.asList(account_1, account_2), INTER,
402402
new HashSet<>(Arrays.asList(region_1, region_2, region_3)))
403403
)));
404-
previousModel.setOperationPreferences(new OperationPreferences(null, null, null, null, null, null));
404+
previousModel.setOperationPreferences(new OperationPreferences(null, null, null, null, null, null, null));
405405

406406
Set<StackInstances> desiredCreateInstances = new LinkedHashSet<>();
407407
Set<StackInstances> desiredDeleteInstances = new LinkedHashSet<>(Arrays.asList(
@@ -492,7 +492,7 @@ public void test_ALT_Update_With_Region_Order() {
492492
new HashSet<>(Arrays.asList(region_1, region_2, region_4)))
493493
)));
494494
List<String> regionOrder = Arrays.asList(region_4, region_3, region_2, region_1);
495-
OperationPreferences operationPreferences = new OperationPreferences(null, null, null, null, regionOrder, null);
495+
OperationPreferences operationPreferences = new OperationPreferences(null, null, null, null, regionOrder, null, null);
496496
currentModel.setOperationPreferences(operationPreferences);
497497
previousModel.setOperationPreferences(operationPreferences);
498498

aws-cloudformation-stackset/src/test/java/software/amazon/cloudformation/stackset/util/TestUtils.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package software.amazon.cloudformation.stackset.util;
22

33
import com.google.common.collect.ImmutableMap;
4+
import software.amazon.awssdk.services.cloudformation.model.ConcurrencyMode;
45
import software.amazon.awssdk.services.cloudformation.model.CreateStackInstancesResponse;
56
import software.amazon.awssdk.services.cloudformation.model.CreateStackSetResponse;
67
import software.amazon.awssdk.services.cloudformation.model.DeleteStackInstancesResponse;
@@ -199,6 +200,7 @@ public class TestUtils {
199200
.maxConcurrentPercentage(100)
200201
.regionOrder(Arrays.asList(US_WEST_1, US_EAST_1))
201202
.regionConcurrencyType(RegionConcurrencyType.PARALLEL.toString())
203+
.concurrencyMode(ConcurrencyMode.STRICT_FAILURE_TOLERANCE.toString())
202204
.build();
203205

204206
public final static ManagedExecution MANAGED_EXECUTION_ENABLED_RESOURCE_MODEL = ManagedExecution.builder()

0 commit comments

Comments
 (0)