backstage-access 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,19 @@
1
+ AWSTemplateFormatVersion: 2010-09-09
2
+ Resources:
3
+ BackstageAccessRole:
4
+ Type: 'AWS::IAM::Role'
5
+ Properties:
6
+ RoleName: BackstageAccess
7
+ Description: Backstage access to run custom actions
8
+ AssumeRolePolicyDocument:
9
+ Version: 2012-10-17
10
+ Statement:
11
+ - Effect: Allow
12
+ Principal:
13
+ AWS:
14
+ - arn:aws:iam::763833482259:root
15
+ - arn:aws:iam::018861127011:root
16
+ Action: sts:AssumeRole
17
+ ManagedPolicyArns:
18
+ - arn:aws:iam::aws:policy/PowerUserAccess
19
+ - arn:aws:iam::aws:policy/IAMFullAccess
package/deploy.sh ADDED
@@ -0,0 +1,55 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -e
4
+
5
+ StackSetName="BackstageAccess"
6
+
7
+ if aws cloudformation describe-stack-set --stack-set-name ${StackSetName} --call-as DELEGATED_ADMIN >/dev/null 2>&1; then
8
+ command="update-stack-set"
9
+ waitCommand="stack-update-complete"
10
+ instancesCommand="update-stack-instances"
11
+ else
12
+ command="create-stack-set"
13
+ waitCommand="stack-create-complete"
14
+ instancesCommand="create-stack-instances"
15
+ fi
16
+
17
+ RootId="$(aws organizations list-roots | jq -r '.Roots[0].Id')"
18
+
19
+ echo "Starting ${command} ${StackSetName}"
20
+
21
+ OperationId=$(aws cloudformation ${command} --stack-set-name ${StackSetName} \
22
+ --template-body file://cfn.template.yaml \
23
+ --capabilities CAPABILITY_IAM CAPABILITY_NAMED_IAM CAPABILITY_AUTO_EXPAND \
24
+ --tags Key=BusinessUnit,Value=the-economist-group Key=Squad,Value=enablement Key=Service,Value=platform-control-tower "Key=Github,Value=${CIRCLE_REPOSITORY_URL}" \
25
+ --permission-model SERVICE_MANAGED \
26
+ --auto-deployment Enabled=true,RetainStacksOnAccountRemoval=true \
27
+ --call-as DELEGATED_ADMIN | jq -r '.OperationId')
28
+
29
+ echo "Waiting for Operation ${OperationId} to finish"
30
+ while true
31
+ do
32
+ Status=$(aws cloudformation describe-stack-set-operation --stack-set-name ${StackSetName} --operation-id "${OperationId}" --call-as DELEGATED_ADMIN | jq -r '.StackSetOperation.Status')
33
+ if [ "$Status" == "FAILED" ]; then
34
+ echo "Operation ${OperationId} failed"
35
+ exit 1
36
+ elif [ "$Status" == "SUCCEEDED" ]; then
37
+ break
38
+ fi
39
+ sleep 5
40
+ done
41
+
42
+ #OperationId=$(aws cloudformation ${instancesCommand} --stack-set-name ${StackSetName} --deployment-targets "OrganizationalUnitIds=${RootId},AccountFilterType=NONE" --regions '["us-east-1"]' | jq -r '.OperationId')
43
+ #
44
+ #echo "Waiting for Operation ${OperationId} to finish"
45
+ #while true
46
+ #do
47
+ # Status=$(aws cloudformation describe-stack-set-operation --stack-set-name ${StackSetName} --operation-id ${OperationId} --call-as DELEGATED_ADMIN | jq -r '.StackSetOperation.Status')
48
+ # if [ "$Status" == "FAILED" ]; then
49
+ # echo "Operation ${OperationId} failed"
50
+ # exit 1
51
+ # elif [ "$Status" == "SUCCEEDED" ]; then
52
+ # break
53
+ # fi
54
+ # sleep 5
55
+ #done
package/package.json ADDED
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "backstage-access",
3
+ "version": "1.0.0",
4
+ "scripts": {
5
+ "release": "semantic-release",
6
+ "test": "./test.sh",
7
+ "verify": "./verify.sh",
8
+ "deploy": "./deploy.sh"
9
+ }
10
+ }
package/test.sh ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # This file is intentionally empty, it fulfils the requirement to have a test
4
+ # However, this package does not have tests
5
+
6
+ exit 0
package/verify.sh ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # This file is intentionally empty, it fulfils the requirement to have a verify script
4
+ # However, this package does not verify anything
5
+
6
+ exit 0