Skip to content

Commit b006bd8

Browse files
author
Joshua Leaverton
committed
Version 1.2.0
1 parent 8b75f64 commit b006bd8

28 files changed

+1118
-564
lines changed

CHANGELOG.md

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010

1111
## [1.1.0] - 2020-02-25
1212
### Known Issue Fix and Code Optimization
13-
- Stack Instance Deletion Issue: In case there are existing stack instances but
13+
- Fixed Stack Instance Deletion Issue: In case there are existing stack instances but
1414
none of those instances belongs to the accounts specified in the user manifest
1515
file as the input for the StackSet state machine, the deletion of the existing
1616
stack instances would fail. This issue is not applicable if at least one account
17-
in the input account list has an exsiting stack instance.
18-
- Code Optimization for Best Practice
17+
in the input account list has an existing stack instance.
18+
- Code Optimization for Best Practice
19+
20+
## [1.2.0] - 2020-06-20
21+
### Added
22+
- Feature to select AWS CodePipeline source (AWS CodeCommit repository or Amazon S3 bucket).
23+
- Feature to switch between the two CodePipeline sources.
24+
- Feature to use an existing AWS CodeCommit repository.
25+
### Changed
26+
- Uses Virtual Hosted-Style URLs (path-style URLs will be deprecated in Sept 2020).
27+
- Uses regional endpoint for S3 APIs.
28+
- Increases the stack set operation fault tolerance from 0 to 10 percent to allow parallel stack instance deployments.
29+
- Updates the AWS CodeBuild image to the latest available version (aws/codebuild/standard:4.0).
30+
- Optimizes the CloudFormation resource stage to trigger step function execution only if there is difference between the configuration and deployed stack sets.
31+
- Fixes the issue in the build stage of the CodePipeline by updating manifest version to match the manifest schema.
32+
- Fixes the issue for comparing deployed stack set templates and parameters [#4](https://github.com/awslabs/aws-control-tower-customizations/issues/4)
33+
- Fixes the issue for updating the variables in the files using Jinja [#17](https://github.com/awslabs/aws-control-tower-customizations/issues/17)

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,9 @@ To get started with the Customizations for AWS Control Tower solution, please re
88
* Clone the repository, then make the desired code changes
99
* Next, run unit tests to make sure added customization passes the tests
1010

11-
```
12-
cd ./deployment
13-
chmod +x ./run-unit-tests.sh
14-
./run-unit-tests.sh
11+
```
12+
chmod +x ./deployment/run-unit-tests.sh
13+
./deployment/run-unit-tests.sh
1514
```
1615

1716
## Building the customized solution

deployment/build-s3-dist.sh

Lines changed: 50 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -20,114 +20,96 @@
2020
# Check to see if input has been provided:
2121
if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ] || [ -z "$4" ]; then
2222
echo "Please provide the base source bucket name, template-bucket, trademark approved solution name, and version"
23-
echo "For example: ./build-s3-dist.sh solutions template-bucket trademarked-solution-name v1.0.0"
23+
echo "For example: ./build-s3-dist.sh solutions template-bucket trademarked-solution-name v1.0.0"
2424
exit 1
2525
fi
2626

27-
# Get reference for all important folders
27+
# declare variables
2828
template_dir="$PWD"
2929
template_dist_dir="$template_dir/deployment/global-s3-assets"
3030
build_dist_dir="$template_dir/deployment/regional-s3-assets"
31+
CODE_BUCKET_NAME=$1
32+
TEMPLATE_BUCKET_NAME=$2
33+
SOLUTION_NAME=$3
34+
VERSION_NUMBER=$4
3135

3236
echo "------------------------------------------------------------------------------"
3337
echo "[Init] Clean old dist and recreate directories"
3438
echo "------------------------------------------------------------------------------"
3539
echo "rm -rf $template_dist_dir"
36-
rm -rf $template_dist_dir
40+
rm -rf "$template_dist_dir"
3741
echo "mkdir -p $template_dist_dir"
38-
mkdir -p $template_dist_dir
42+
mkdir -p "$template_dist_dir"
3943
echo "rm -rf $build_dist_dir"
40-
rm -rf $build_dist_dir
44+
rm -rf "$build_dist_dir"
4145
echo "mkdir -p $build_dist_dir"
42-
mkdir -p $build_dist_dir
46+
mkdir -p "$build_dist_dir"
4347

4448
# Create zip file for AWS Lambda functions
4549
echo -e "\n Creating all lambda functions for Custom Control Tower Solution"
4650
python source/bin/build_scripts/lambda_build.py state_machine_lambda deployment_lambda build_scripts lifecycle_event_handler state_machine_trigger
4751
#python source/bin/build_scripts/lambda_build.py state_machine_lambda deployment_lambda build_scripts lifecycle_event_handler
4852

4953
echo -e "\n Cleaning up the tests folder from the lambda zip files"
50-
zip -d $build_dist_dir/custom-control-tower-config-deployer.zip tests/*
51-
zip -d $build_dist_dir/custom-control-tower-state-machine.zip tests/*
52-
zip -d $build_dist_dir/custom-control-tower-scripts.zip tests/*
53-
zip -d $build_dist_dir/custom-control-tower-lifecycle-event-handler.zip tests/*
54-
zip -d $build_dist_dir/custom-control-tower-state-machine-trigger.zip tests/*
54+
zip -d "$build_dist_dir"/custom-control-tower-config-deployer.zip tests/*
55+
zip -d "$build_dist_dir"/custom-control-tower-state-machine.zip tests/*
56+
zip -d "$build_dist_dir"/custom-control-tower-scripts.zip tests/*
57+
zip -d "$build_dist_dir"/custom-control-tower-lifecycle-event-handler.zip tests/*
58+
zip -d "$build_dist_dir"/custom-control-tower-state-machine-trigger.zip tests/*
5559

5660
# Move custom-control-tower-initiation.template to global-s3-assets
5761
echo "cp -f deployment/custom-control-tower-initiation.template $template_dist_dir"
58-
cp -f deployment/custom-control-tower-initiation.template $template_dist_dir
62+
cp -f deployment/custom-control-tower-initiation.template "$template_dist_dir"
5963

6064
#COPY deployment/add-on to $build_dist_dir/add-on
61-
mkdir $template_dist_dir/add-on/
62-
cp -f -R deployment/add-on/. $template_dist_dir/add-on
65+
mkdir "$template_dist_dir"/add-on/
66+
cp -f -R deployment/add-on/. "$template_dist_dir"/add-on
6367

6468
#COPY custom_control_tower_configuration to global-s3-assets
6569
#Please check to see if this is the correct location or template_dist_dir
66-
cp -f -R deployment/custom_control_tower_configuration $build_dist_dir/custom_control_tower_configuration/
70+
cp -f -R deployment/custom_control_tower_configuration "$build_dist_dir"/custom_control_tower_configuration/
6771

68-
echo -e "\n Updating code source bucket in the template with $1"
69-
replace="s/%DIST_BUCKET_NAME%/$1/g"
72+
echo -e "\n Updating code source bucket in the template with $CODE_BUCKET_NAME"
73+
replace="s/%DIST_BUCKET_NAME%/$CODE_BUCKET_NAME/g"
7074
echo "sed -i -e $replace $template_dist_dir/custom-control-tower-initiation.template"
71-
sed -i -e $replace $template_dist_dir/custom-control-tower-initiation.template
75+
sed -i -e "$replace" "$template_dist_dir"/custom-control-tower-initiation.template
7276

73-
cd $template_dist_dir/add-on
74-
for y in `find . -name "*.template"`;
75-
do
76-
echo "sed -i -e $replace $y"
77-
sed -i -e $replace $y
78-
done
79-
cd ../../..
80-
81-
echo -e "\n Updating template bucket in the template with $2"
82-
replace="s/%TEMPLATE_BUCKET_NAME%/$2/g"
77+
echo -e "\n Updating template bucket in the template with $TEMPLATE_BUCKET_NAME"
78+
replace="s/%TEMPLATE_BUCKET_NAME%/$TEMPLATE_BUCKET_NAME/g"
8379
echo "sed -i -e $replace $template_dist_dir/custom-control-tower-initiation.template"
84-
sed -i -e $replace $template_dist_dir/custom-control-tower-initiation.template
85-
echo "sed -i -e $replace $build_dist_dir/$rss_file_name"
86-
sed -i -e $replace $build_dist_dir/$rss_file_name
87-
88-
cd $template_dist_dir/add-on
89-
for y in `find . -name "*.template"`;
90-
do
91-
echo "sed -i -e $replace $y"
92-
sed -i -e $replace $y
93-
done
94-
cd ../../..
80+
sed -i -e "$replace" "$template_dist_dir"/custom-control-tower-initiation.template
9581

9682
# Replace solution name with real value
97-
echo -e "\n >> Updating solution name in the template with $3"
98-
replace="s/%SOLUTION_NAME%/$3/g"
83+
echo -e "\n Updating solution name in the template with $SOLUTION_NAME"
84+
replace="s/%SOLUTION_NAME%/$SOLUTION_NAME/g"
9985
echo "sed -i -e $replace $template_dist_dir/custom-control-tower-initiation.template"
100-
sed -i -e $replace $template_dist_dir/custom-control-tower-initiation.template
86+
sed -i -e "$replace" "$template_dist_dir"/custom-control-tower-initiation.template
10187

102-
cd $template_dist_dir/add-on
103-
for y in `find . -name "*.template"`;
104-
do
105-
echo "sed -i -e $replace $y"
106-
sed -i -e $replace $y
107-
done
108-
cd ../../..
109-
110-
echo -e "\n Updating version number in the template with $4"
111-
replace="s/%VERSION%/$4/g"
88+
echo -e "\n Updating version number in the template with $VERSION_NUMBER"
89+
replace="s/%VERSION%/$VERSION_NUMBER/g"
11290
echo "sed -i -e $replace $template_dist_dir/custom-control-tower-initiation.template"
113-
sed -i -e $replace $template_dist_dir/custom-control-tower-initiation.template
114-
115-
echo "sed -i -e $replace $template_dist_dir/$rss_file_name"
116-
sed -i -e $replace $template_dist_dir/$rss_file_name
117-
118-
cd $template_dist_dir/add-on
119-
for y in `find . -name "*.template"`;
120-
do
121-
echo "sed -i -e $replace $y"
122-
sed -i -e $replace $y
123-
done
124-
cd ../../..
91+
sed -i -e "$replace" "$template_dist_dir"/custom-control-tower-initiation.template
12592

12693
# Create configuration zip file
12794
echo -e "\n Creating zip file with Custom Control Tower configuration"
128-
cd $build_dist_dir/custom_control_tower_configuration/; zip -Xr $build_dist_dir/custom-control-tower-configuration.zip ./* ; cd -
129-
95+
cd "$build_dist_dir"/custom_control_tower_configuration/
96+
zip -Xr "$build_dist_dir"/custom-control-tower-configuration.zip ./*
97+
98+
# build regional config zip file
99+
echo -e "\n*** Build regional config zip file"
100+
declare -a region_list=( "ap-northeast-2" "ap-southeast-2" "ca-central-1" "eu-west-1" "eu-west-2" "me-south-1" "us-east-1" "us-west-1" "ap-east-1" "ap-south-1" "eu-central-1" "eu-north-1" "eu-west-3" "sa-east-1" "us-east-2" "us-west-2" "ap-northeast-1" "ap-southeast-1" )
101+
for region in "${region_list[@]}"
102+
do
103+
echo -e "\n Building config zip for $region region"
104+
echo -e " Updating region name in the manifest to: $region \n"
105+
replace="s/{{ region }}/$region/g"
106+
cp ./manifest.yaml.j2 ./manifest.yaml
107+
echo "sed -i -e $replace ./manifest.yaml"
108+
sed -i -e "$replace" ./manifest.yaml
109+
echo -e "\n Zipping configuration..."
110+
zip -Xr "$build_dist_dir"/custom-control-tower-configuration-"$region".zip ./manifest.yaml ./example-configuration/*
111+
done
112+
cd -
130113
#Copy Lambda Zip Files to the Global S3 Assets
131114
echo -e "\n Copying lambda zip files to Global S3 Assets"
132-
cp $build_dist_dir/*.zip $template_dist_dir/
133-
115+
cp "$build_dist_dir"/*.zip "$template_dist_dir"/

0 commit comments

Comments
 (0)