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

Encrypting SNS #312

Closed
wants to merge 4 commits into from
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 @@ -9,6 +9,7 @@
"snsNotificationTopic": {
"Type": "AWS::SNS::Topic",
"Properties": {
"KmsMasterKeyId": "alias/aws/sns",
"TopicName": {
"Fn::Join": [
"",
Expand Down
166 changes: 115 additions & 51 deletions deployment/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,61 +25,125 @@ fi

cd ..

aws codecommit create-repository --region $REGION --repository-name team-idc-app --repository-description "Temporary Elevated Access Management (TEAM) Application"
git remote remove origin
git remote add origin codecommit::$REGION://team-idc-app
git push origin main
if [ -z "$SECRET_NAME" ]; then
aws codecommit create-repository --region $REGION --repository-name team-idc-app --repository-description "Temporary Elevated Access Management (TEAM) Application"
git remote remove origin
git remote add origin codecommit::$REGION://team-idc-app
git push origin main

cd ./deployment
if [[ ! -z "$TAGS" ]]; then
if [[ ! -z "$UI_DOMAIN" ]]; then
aws cloudformation deploy --region $REGION --template-file template.yml \
--stack-name TEAM-IDC-APP \
--parameter-overrides \
Login=$IDC_LOGIN_URL \
CloudTrailAuditLogs=$CLOUDTRAIL_AUDIT_LOGS \
teamAdminGroup="$TEAM_ADMIN_GROUP" \
teamAuditGroup="$TEAM_AUDITOR_GROUP" \
tags="$TAGS" \
teamAccount="$TEAM_ACCOUNT" \
customAmplifyDomain="$UI_DOMAIN" \
--tags $TAGS \
--no-fail-on-empty-changeset --capabilities CAPABILITY_NAMED_IAM
cd ./deployment
if [[ ! -z "$TAGS" ]]; then
if [[ ! -z "$UI_DOMAIN" ]]; then
aws cloudformation deploy --region $REGION --template-file template.yml \
--stack-name TEAM-IDC-APP \
--parameter-overrides \
Login=$IDC_LOGIN_URL \
CloudTrailAuditLogs=$CLOUDTRAIL_AUDIT_LOGS \
teamAdminGroup="$TEAM_ADMIN_GROUP" \
teamAuditGroup="$TEAM_AUDITOR_GROUP" \
tags="$TAGS" \
teamAccount="$TEAM_ACCOUNT" \
customAmplifyDomain="$UI_DOMAIN" \
--tags $TAGS \
--no-fail-on-empty-changeset --capabilities CAPABILITY_NAMED_IAM
else
aws cloudformation deploy --region $REGION --template-file template.yml \
--stack-name TEAM-IDC-APP \
--parameter-overrides \
Login=$IDC_LOGIN_URL \
CloudTrailAuditLogs=$CLOUDTRAIL_AUDIT_LOGS \
teamAdminGroup="$TEAM_ADMIN_GROUP" \
teamAuditGroup="$TEAM_AUDITOR_GROUP" \
tags="$TAGS" \
teamAccount="$TEAM_ACCOUNT" \
--tags $TAGS \
--no-fail-on-empty-changeset --capabilities CAPABILITY_NAMED_IAM
fi
else
aws cloudformation deploy --region $REGION --template-file template.yml \
--stack-name TEAM-IDC-APP \
--parameter-overrides \
Login=$IDC_LOGIN_URL \
CloudTrailAuditLogs=$CLOUDTRAIL_AUDIT_LOGS \
teamAdminGroup="$TEAM_ADMIN_GROUP" \
teamAuditGroup="$TEAM_AUDITOR_GROUP" \
tags="$TAGS" \
teamAccount="$TEAM_ACCOUNT" \
--tags $TAGS \
--no-fail-on-empty-changeset --capabilities CAPABILITY_NAMED_IAM
if [[ ! -z "$UI_DOMAIN" ]]; then
aws cloudformation deploy --region $REGION --template-file template.yml \
--stack-name TEAM-IDC-APP \
--parameter-overrides \
Login=$IDC_LOGIN_URL \
CloudTrailAuditLogs=$CLOUDTRAIL_AUDIT_LOGS \
teamAdminGroup="$TEAM_ADMIN_GROUP" \
teamAuditGroup="$TEAM_AUDITOR_GROUP" \
teamAccount="$TEAM_ACCOUNT" \
tags="$TAGS" \
customAmplifyDomain="$UI_DOMAIN" \
--no-fail-on-empty-changeset --capabilities CAPABILITY_NAMED_IAM
else
aws cloudformation deploy --region $REGION --template-file template.yml \
--stack-name TEAM-IDC-APP \
--parameter-overrides \
Login=$IDC_LOGIN_URL \
CloudTrailAuditLogs=$CLOUDTRAIL_AUDIT_LOGS \
teamAdminGroup="$TEAM_ADMIN_GROUP" \
teamAuditGroup="$TEAM_AUDITOR_GROUP" \
teamAccount="$TEAM_ACCOUNT" \
--no-fail-on-empty-changeset --capabilities CAPABILITY_NAMED_IAM
fi
fi
else
if [[ ! -z "$UI_DOMAIN" ]]; then
aws cloudformation deploy --region $REGION --template-file template.yml \
--stack-name TEAM-IDC-APP \
--parameter-overrides \
Login=$IDC_LOGIN_URL \
CloudTrailAuditLogs=$CLOUDTRAIL_AUDIT_LOGS \
teamAdminGroup="$TEAM_ADMIN_GROUP" \
teamAuditGroup="$TEAM_AUDITOR_GROUP" \
teamAccount="$TEAM_ACCOUNT" \
tags="$TAGS" \
customAmplifyDomain="$UI_DOMAIN" \
--no-fail-on-empty-changeset --capabilities CAPABILITY_NAMED_IAM
cd ./deployment
if [[ ! -z "$TAGS" ]]; then
if [[ ! -z "$UI_DOMAIN" ]]; then
aws cloudformation deploy --region $REGION --template-file template.yml \
--stack-name TEAM-IDC-APP \
--parameter-overrides \
Login=$IDC_LOGIN_URL \
CloudTrailAuditLogs=$CLOUDTRAIL_AUDIT_LOGS \
teamAdminGroup="$TEAM_ADMIN_GROUP" \
teamAuditGroup="$TEAM_AUDITOR_GROUP" \
tags="$TAGS" \
teamAccount="$TEAM_ACCOUNT" \
customAmplifyDomain="$UI_DOMAIN" \
customRepository="Yes" \
customRepositorySecretName="$SECRET_NAME" \
--tags $TAGS \
--no-fail-on-empty-changeset --capabilities CAPABILITY_NAMED_IAM
else
aws cloudformation deploy --region $REGION --template-file template.yml \
--stack-name TEAM-IDC-APP \
--parameter-overrides \
Login=$IDC_LOGIN_URL \
CloudTrailAuditLogs=$CLOUDTRAIL_AUDIT_LOGS \
teamAdminGroup="$TEAM_ADMIN_GROUP" \
teamAuditGroup="$TEAM_AUDITOR_GROUP" \
tags="$TAGS" \
teamAccount="$TEAM_ACCOUNT" \
customRepository="Yes" \
customRepositorySecretName="$SECRET_NAME" \
--tags $TAGS \
--no-fail-on-empty-changeset --capabilities CAPABILITY_NAMED_IAM
fi
else
aws cloudformation deploy --region $REGION --template-file template.yml \
--stack-name TEAM-IDC-APP \
--parameter-overrides \
Login=$IDC_LOGIN_URL \
CloudTrailAuditLogs=$CLOUDTRAIL_AUDIT_LOGS \
teamAdminGroup="$TEAM_ADMIN_GROUP" \
teamAuditGroup="$TEAM_AUDITOR_GROUP" \
teamAccount="$TEAM_ACCOUNT" \
--no-fail-on-empty-changeset --capabilities CAPABILITY_NAMED_IAM
if [[ ! -z "$UI_DOMAIN" ]]; then
aws cloudformation deploy --region $REGION --template-file template.yml \
--stack-name TEAM-IDC-APP \
--parameter-overrides \
Login=$IDC_LOGIN_URL \
CloudTrailAuditLogs=$CLOUDTRAIL_AUDIT_LOGS \
teamAdminGroup="$TEAM_ADMIN_GROUP" \
teamAuditGroup="$TEAM_AUDITOR_GROUP" \
teamAccount="$TEAM_ACCOUNT" \
tags="$TAGS" \
customAmplifyDomain="$UI_DOMAIN" \
customRepository="Yes" \
customRepositorySecretName="$SECRET_NAME" \
--no-fail-on-empty-changeset --capabilities CAPABILITY_NAMED_IAM
else
aws cloudformation deploy --region $REGION --template-file template.yml \
--stack-name TEAM-IDC-APP \
--parameter-overrides \
Login=$IDC_LOGIN_URL \
CloudTrailAuditLogs=$CLOUDTRAIL_AUDIT_LOGS \
teamAdminGroup="$TEAM_ADMIN_GROUP" \
teamAuditGroup="$TEAM_AUDITOR_GROUP" \
teamAccount="$TEAM_ACCOUNT" \
customRepository="Yes" \
customRepositorySecretName="$SECRET_NAME" \
--no-fail-on-empty-changeset --capabilities CAPABILITY_NAMED_IAM
fi
fi
fi
4 changes: 3 additions & 1 deletion deployment/destroy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,6 @@ aws cloudformation delete-stack --region $REGION --stack-name $stackName

aws cloudformation delete-stack --region $REGION --stack-name TEAM-IDC-APP

aws codecommit delete-repository --region $REGION \--repository-name team-idc-app
if [ -z "$SECRET_NAME" ]; then
aws codecommit delete-repository --region $REGION \--repository-name team-idc-app
fi
7 changes: 6 additions & 1 deletion deployment/parameters-mgmt-template.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,9 @@ TEAM_ADMIN_GROUP="team_admin_group_name"
TEAM_AUDITOR_GROUP="team_auditor_group_name"
TAGS="project=iam-identity-center-team environment=prod"
CLOUDTRAIL_AUDIT_LOGS=read_write
UI_DOMAIN=portal.teamtest.online

# Uncomment the next line only if you have a custom domain
# UI_DOMAIN=portal.teamtest.online

# Uncomment the next line only if you are using an external repo with an Access Token in lieu of AWS CodeCommit
# SECRET_NAME=TEAM-IDC-APP
3 changes: 3 additions & 0 deletions deployment/parameters-template.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@ CLOUDTRAIL_AUDIT_LOGS=arn:aws:cloudtrail:us-east-1:123456789101:eventdatastore/e

# Uncomment the next line only if you have a custom domain
# UI_DOMAIN=portal.teamtest.online

# Uncomment the next line only if you are using an external repo with an Access Token in lieu of AWS CodeCommit
# SECRET_NAME=TEAM-IDC-APP
23 changes: 22 additions & 1 deletion deployment/template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,21 @@ Parameters:
Type: String
Description: Custom domain for the TEAM application
Default: ""
customRepository:
Type: String
Description: Use a custom repository for the TEAM application?
AllowedValues:
- 'Yes'
- 'No'
Default: 'No'
customRepositorySecretName:
Type: String
Description: Name of the secret in AWS Secrets Manager
Default: ''

Conditions:
IsEmptyCloudTrailAuditLogs: !Equals [!Ref CloudTrailAuditLogs, ""]
UseExternalRepo: !Equals [!Ref customRepository. 'Yes']

Resources:
TriggerAmplifyBuild:
Expand Down Expand Up @@ -63,7 +75,16 @@ Resources:
Type: "AWS::Amplify::App"
Properties:
Name: TEAM-IDC-APP
Repository: !Sub https://git-codecommit.${AWS::Region}.amazonaws.com/v1/repos/team-idc-app
Repository: !if
- UseExternalRepo
- !Sub >-
{{resolve:secretsmanager:${customRepositorySecretName}:SecretString:url}}
- !Sub https://git-codecommit.${AWS::Region}.amazonaws.com/v1/repos/team-idc-app
AccessToken: !if
- UseExternalRepo
- !Sub >-
{{resolve:secretsmanager:${customRepositorySecretName}:SecretString:AccessToken}}
- !Ref 'AWS::NoValue'
Description: Temporary Elevated Access Management Application
CustomRules:
- Source: /<*>
Expand Down
Loading