Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add operational preferences support or stacksets customization (Continue) #622

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@ exports[`CustomizationsStack Construct(CustomizationsStack): Snapshot Test 1`]
"CAPABILITY_AUTO_EXPAND",
],
"Description": "Sample stackset description",
"OperationPreferences": {
"FailureTolerancePercentage": 25,
"MaxConcurrentPercentage": 35,
"RegionConcurrencyType": "PARALLEL",
},
"OperationPreferences": {},
"PermissionModel": "SELF_MANAGED",
"StackInstancesGroup": [
{
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
Original file line number Diff line number Diff line change
Expand Up @@ -2831,7 +2831,7 @@ phases:
],
},
"Type": "String",
"Value": "1.9.1",
"Value": "1.10.0",
},
"Type": "AWS::SSM::Parameter",
},
Expand Down Expand Up @@ -4006,7 +4006,7 @@ exports[`InstallerStack Stack(installer): Snapshot Test 2`] = `
"RepositoryBranchName": {
"AllowedPattern": ".+",
"ConstraintDescription": "The repository branch name must not be empty",
"Default": "release/v1.9.1",
"Default": "release/v1.10.0",
"Description": "The name of the git branch to use for installation. To determine the branch name, navigate to the Landing Zone Accelerator GitHub branches page and choose the release branch you would like to deploy. Release branch names will align with the semantic versioning of our GitHub releases. New release branches will be available as the open source project is updated with new features.",
"Type": "String",
},
Expand Down Expand Up @@ -6553,7 +6553,7 @@ phases:
],
},
"Type": "String",
"Value": "1.9.1",
"Value": "1.10.0",
},
"Type": "AWS::SSM::Parameter",
},
Expand Down Expand Up @@ -7761,7 +7761,7 @@ exports[`InstallerStack Stack(installer): Snapshot Test 3`] = `
"RepositoryBranchName": {
"AllowedPattern": ".+",
"ConstraintDescription": "The repository branch name must not be empty",
"Default": "release/v1.9.1",
"Default": "release/v1.10.0",
"Description": "The name of the git branch to use for installation. To determine the branch name, navigate to the Landing Zone Accelerator GitHub branches page and choose the release branch you would like to deploy. Release branch names will align with the semantic versioning of our GitHub releases. New release branches will be available as the open source project is updated with new features.",
"Type": "String",
},
Expand Down Expand Up @@ -10345,7 +10345,7 @@ phases:
],
},
"Type": "String",
"Value": "1.9.1",
"Value": "1.10.0",
},
"Type": "AWS::SSM::Parameter",
},
Expand Down Expand Up @@ -11536,7 +11536,7 @@ exports[`InstallerStack Stack(installer): Snapshot Test 4`] = `
"RepositoryBranchName": {
"AllowedPattern": ".+",
"ConstraintDescription": "The repository branch name must not be empty",
"Default": "release/v1.9.1",
"Default": "release/v1.10.0",
"Description": "The name of the git branch to use for installation. To determine the branch name, navigate to the Landing Zone Accelerator GitHub branches page and choose the release branch you would like to deploy. Release branch names will align with the semantic versioning of our GitHub releases. New release branches will be available as the open source project is updated with new features.",
"Type": "String",
},
Expand Down Expand Up @@ -14110,7 +14110,7 @@ phases:
],
},
"Type": "String",
"Value": "1.9.1",
"Value": "1.10.0",
},
"Type": "AWS::SSM::Parameter",
},
Expand Down Expand Up @@ -15301,7 +15301,7 @@ exports[`InstallerStack Stack(installer): Snapshot Test 5`] = `
"RepositoryBranchName": {
"AllowedPattern": ".+",
"ConstraintDescription": "The repository branch name must not be empty",
"Default": "release/v1.9.1",
"Default": "release/v1.10.0",
"Description": "The name of the git branch to use for installation. To determine the branch name, navigate to the Landing Zone Accelerator GitHub branches page and choose the release branch you would like to deploy. Release branch names will align with the semantic versioning of our GitHub releases. New release branches will be available as the open source project is updated with new features.",
"Type": "String",
},
Expand Down Expand Up @@ -17880,7 +17880,7 @@ phases:
],
},
"Type": "String",
"Value": "1.9.1",
"Value": "1.10.0",
},
"Type": "AWS::SSM::Parameter",
},
Expand Down Expand Up @@ -19050,7 +19050,7 @@ exports[`InstallerStack Stack(installer): Snapshot Test 6`] = `
"RepositoryBranchName": {
"AllowedPattern": ".+",
"ConstraintDescription": "The repository branch name must not be empty",
"Default": "release/v1.9.1",
"Default": "release/v1.10.0",
"Description": "The name of the git branch to use for installation. To determine the branch name, navigate to the Landing Zone Accelerator GitHub branches page and choose the release branch you would like to deploy. Release branch names will align with the semantic versioning of our GitHub releases. New release branches will be available as the open source project is updated with new features.",
"Type": "String",
},
Expand Down Expand Up @@ -21604,7 +21604,7 @@ phases:
],
},
"Type": "String",
"Value": "1.9.1",
"Value": "1.10.0",
},
"Type": "AWS::SSM::Parameter",
},
Expand Down Expand Up @@ -22800,7 +22800,7 @@ exports[`InstallerStack Stack(installer): Snapshot Test 7`] = `
"RepositoryBranchName": {
"AllowedPattern": ".+",
"ConstraintDescription": "The repository branch name must not be empty",
"Default": "release/v1.9.1",
"Default": "release/v1.10.0",
"Description": "The name of the git branch to use for installation. To determine the branch name, navigate to the Landing Zone Accelerator GitHub branches page and choose the release branch you would like to deploy. Release branch names will align with the semantic versioning of our GitHub releases. New release branches will be available as the open source project is updated with new features.",
"Type": "String",
},
Expand All @@ -22814,7 +22814,7 @@ exports[`InstallerStack Stack(installer): Snapshot Test 7`] = `
"Type": "String",
},
"RepositoryBucketObject": {
"Default": "release/v1.9.1.zip",
"Default": "release/v1.10.0.zip",
"Description": "The full path to the accelerator code zip S3 Object. (S3 Only)",
"Type": "String",
},
Expand Down Expand Up @@ -25720,7 +25720,7 @@ phases:
],
},
"Type": "String",
"Value": "1.9.1",
"Value": "1.10.0",
},
"Type": "AWS::SSM::Parameter",
},
Expand Down
Loading