diff --git a/source/packages/@aws-accelerator/accelerator/lib/stacks/customizations-stack.ts b/source/packages/@aws-accelerator/accelerator/lib/stacks/customizations-stack.ts index 5b9d19386..65565c429 100644 --- a/source/packages/@aws-accelerator/accelerator/lib/stacks/customizations-stack.ts +++ b/source/packages/@aws-accelerator/accelerator/lib/stacks/customizations-stack.ts @@ -96,6 +96,16 @@ export class CustomizationsStack extends AcceleratorStack { const parameters = stackSet.parameters?.map(parameter => { return { parameterKey: parameter.name, parameterValue: parameter.value }; }); + + const operationPreferences: cdk.CfnStackSet.OperationPreferencesProperty = { + failureToleranceCount: stackSet.operationPreferences?.failureToleranceCount, + failureTolerancePercentage: stackSet.operationPreferences?.failureTolerancePercentage, + maxConcurrentCount: stackSet.operationPreferences?.maxConcurrentCount, + maxConcurrentPercentage: stackSet.operationPreferences?.maxConcurrentPercentage, + regionConcurrencyType: stackSet.operationPreferences?.regionConcurrencyType, + regionOrder: stackSet.operationPreferences?.regionOrder, + }; + const stackSetObj = new cdk.aws_cloudformation.CfnStackSet( this, pascalCase(`${this.props.prefixes.accelerator}-Custom-${stackSet.name}`), @@ -104,11 +114,7 @@ export class CustomizationsStack extends AcceleratorStack { stackSetName: stackSet.name, capabilities: stackSet.capabilities, description: stackSet.description, - operationPreferences: { - failureTolerancePercentage: 25, - maxConcurrentPercentage: 35, - regionConcurrencyType: 'PARALLEL', - }, + operationPreferences: operationPreferences, stackInstancesGroup: [ { deploymentTargets: { diff --git a/source/packages/@aws-accelerator/config/lib/common/types.ts b/source/packages/@aws-accelerator/config/lib/common/types.ts index 36e6a3e2b..9ec6ec84e 100644 --- a/source/packages/@aws-accelerator/config/lib/common/types.ts +++ b/source/packages/@aws-accelerator/config/lib/common/types.ts @@ -393,6 +393,23 @@ export class Tag implements ITag { readonly value: string = ''; } +export interface IOperationPreferences { + failureToleranceCount?: number; + failureTolerancePercentage?: number; + maxConcurrentCount?: number; + maxConcurrentPercentage?: number; + regionConcurrencyType?: string; + regionOrder?: string[]; +} +export class OperationPreferences implements IOperationPreferences { + readonly failureToleranceCount: number | undefined = undefined; + readonly failureTolerancePercentage: number = 25; + readonly maxConcurrentCount: number | undefined = undefined; + readonly maxConcurrentPercentage: number = 35; + readonly regionConcurrencyType: string = 'PARALLEL'; + readonly regionOrder: string[] | undefined = undefined; +} + export interface ICfnParameter { name: string; value: string; diff --git a/source/packages/@aws-accelerator/config/lib/customizations-config.ts b/source/packages/@aws-accelerator/config/lib/customizations-config.ts index 5d39460a1..f651c08f2 100644 --- a/source/packages/@aws-accelerator/config/lib/customizations-config.ts +++ b/source/packages/@aws-accelerator/config/lib/customizations-config.ts @@ -76,6 +76,7 @@ export class CloudFormationStackSetConfig implements i.ICloudFormationStackSet { readonly regions: t.Region[] = ['us-east-1']; readonly template: string = ''; readonly parameters: t.CfnParameter[] | undefined = undefined; + readonly operationPreferences: t.OperationPreferences | undefined = undefined; readonly dependsOn: string[] = []; } diff --git a/source/packages/@aws-accelerator/config/lib/models/customizations-config.ts b/source/packages/@aws-accelerator/config/lib/models/customizations-config.ts index 751bcbfb5..f218b7bd7 100644 --- a/source/packages/@aws-accelerator/config/lib/models/customizations-config.ts +++ b/source/packages/@aws-accelerator/config/lib/models/customizations-config.ts @@ -1583,6 +1583,10 @@ export interface ICloudFormationStackSet { * The parameters to be passed to the stackset. */ readonly parameters?: t.ICfnParameter[]; + /** + * The operational preferences of current stackset + */ + readonly operationPreferences?: t.IOperationPreferences; /** * The other StackSets this StackSet depends on. * For stackset names you define here, a CloudFormation DependsOn attribute will be added between the resources. diff --git a/source/packages/@aws-accelerator/config/lib/schemas/customizations-config.json b/source/packages/@aws-accelerator/config/lib/schemas/customizations-config.json index 9e81941f0..e92d4eddc 100644 --- a/source/packages/@aws-accelerator/config/lib/schemas/customizations-config.json +++ b/source/packages/@aws-accelerator/config/lib/schemas/customizations-config.json @@ -501,6 +501,10 @@ "$ref": "#/definitions/NonEmptyString", "description": "The friendly name that will be used as a base for the created CloudFormation StackSet Name. The name should not contain any spaces as this isn't supported by the Accelerator." }, + "operationPreferences": { + "$ref": "#/definitions/IOperationPreferences", + "description": "The operational preferences of current stackset" + }, "parameters": { "description": "The parameters to be passed to the stackset.", "items": { @@ -1052,6 +1056,33 @@ ], "type": "object" }, + "IOperationPreferences": { + "additionalProperties": false, + "properties": { + "failureToleranceCount": { + "type": "number" + }, + "failureTolerancePercentage": { + "type": "number" + }, + "maxConcurrentCount": { + "type": "number" + }, + "maxConcurrentPercentage": { + "type": "number" + }, + "regionConcurrencyType": { + "type": "string" + }, + "regionOrder": { + "items": { + "type": "string" + }, + "type": "array" + } + }, + "type": "object" + }, "IPortfolioAssociatoinConfig": { "additionalProperties": false, "description": "Portfolio Associations configuration",