Skip to content

Commit

Permalink
add concurrency_mode parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
nkraemer-sysdig committed Jul 23, 2024
1 parent 90a2781 commit 61838d7
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .changelog/38498.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/aws_cloudformation_stack_set_instance: Add `concurrency_mode` argument
```
5 changes: 5 additions & 0 deletions internal/service/cloudformation/stack_set_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,11 @@ func resourceStackSetInstance() *schema.Resource {
ValidateFunc: validation.IntBetween(1, 100),
ConflictsWith: []string{"operation_preferences.0.max_concurrent_count"},
},
"concurrency_mode": {
Type: schema.TypeString,
Optional: true,
ValidateDiagFunc: enum.Validate[awstypes.ConcurrencyMode](),
},
"region_concurrency_type": {
Type: schema.TypeString,
Optional: true,
Expand Down
2 changes: 2 additions & 0 deletions internal/service/cloudformation/stack_set_instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ func TestAccCloudFormationStackSetInstance_operationPreferences(t *testing.T) {
resource.TestCheckResourceAttr(resourceName, "operation_preferences.0.failure_tolerance_percentage", acctest.Ct0),
resource.TestCheckResourceAttr(resourceName, "operation_preferences.0.max_concurrent_count", acctest.Ct10),
resource.TestCheckResourceAttr(resourceName, "operation_preferences.0.max_concurrent_percentage", acctest.Ct0),
resource.TestCheckResourceAttr(resourceName, "operation_preferences.0.concurrency_mode", "SOFT_FAILURE_TOLERANCE"),
resource.TestCheckResourceAttr(resourceName, "operation_preferences.0.region_concurrency_type", ""),
),
},
Expand Down Expand Up @@ -853,6 +854,7 @@ resource "aws_cloudformation_stack_set_instance" "test" {
operation_preferences {
failure_tolerance_count = 1
max_concurrent_count = 10
concurrency_mode = "SOFT_FAILURE_TOLERANCE"
}
deployment_targets {
Expand Down
3 changes: 3 additions & 0 deletions internal/service/cloudformation/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,9 @@ func expandOperationPreferences(tfMap map[string]interface{}) *awstypes.StackSet
if v, ok := tfMap["max_concurrent_percentage"].(int); ok {
apiObject.MaxConcurrentPercentage = aws.Int32(int32(v))
}
if v, ok := tfMap["concurrency_mode"].(string); ok && v != "" {
apiObject.ConcurrencyMode = awstypes.ConcurrencyMode(v)
}
if v, ok := tfMap["region_concurrency_type"].(string); ok && v != "" {
apiObject.RegionConcurrencyType = awstypes.RegionConcurrencyType(v)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ The `operation_preferences` configuration block supports the following arguments
* `failure_tolerance_percentage` - (Optional) Percentage of accounts, per Region, for which this stack operation can fail before AWS CloudFormation stops the operation in that Region.
* `max_concurrent_count` - (Optional) Maximum number of accounts in which to perform this operation at one time.
* `max_concurrent_percentage` - (Optional) Maximum percentage of accounts in which to perform this operation at one time.
* `concurrency_mode` - (Optional) Specifies how the concurrency level behaves during the operation execution. Valid values are `STRICT_FAILURE_TOLERANCE` and `SOFT_FAILURE_TOLERANCE`.
* `region_concurrency_type` - (Optional) Concurrency type of deploying StackSets operations in Regions, could be in parallel or one Region at a time. Valid values are `SEQUENTIAL` and `PARALLEL`.
* `region_order` - (Optional) Order of the Regions in where you want to perform the stack operation.

Expand Down

0 comments on commit 61838d7

Please sign in to comment.