Skip to content

Commit

Permalink
feat: add operational preferences support or stacksets customization
Browse files Browse the repository at this point in the history
Export operational preferences option when deploying custom stacksets

feat: add some fixes for operational preferences option

Adding some fixes for operatinal preferences option
  • Loading branch information
allcloud-sahar-hagbi committed Oct 20, 2024
1 parent 26e8805 commit 06d7b06
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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}`),
Expand All @@ -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: {
Expand Down
17 changes: 17 additions & 0 deletions source/packages/@aws-accelerator/config/lib/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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[] = [];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 06d7b06

Please sign in to comment.