-
Notifications
You must be signed in to change notification settings - Fork 256
/
Copy pathsra-common-prerequisites-control-tower-execution-role.yaml
93 lines (89 loc) · 3.23 KB
/
sra-common-prerequisites-control-tower-execution-role.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
########################################################################
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
########################################################################
AWSTemplateFormatVersion: 2010-09-09
Description:
AWS Control Tower Execution IAM Role Creation. - 'common_prerequisites' solution in the repo,
https://github.com/aws-samples/aws-security-reference-architecture-examples
Metadata:
SRA:
Version: 1.0
Order: 2
AWS::CloudFormation::Interface:
ParameterGroups:
- Label:
default: General Properties
Parameters:
- pSRASolutionTagKey
- pSRASolutionName
- Label:
default: Control Tower Role Attributes
Parameters:
- pCreateAWSControlTowerExecutionRole
- pAWSControlTowerExecutionRoleName
ParameterLabels:
pAWSControlTowerExecutionRoleName:
default: AWS Control Tower Execution Role Name
pCreateAWSControlTowerExecutionRole:
default: Create AWS Control Tower Execution Role
pSRASolutionName:
default: SRA Solution Name
pSRASolutionTagKey:
default: SRA Solution Tag Key
Parameters:
pAWSControlTowerExecutionRoleName:
AllowedValues: [AWSControlTowerExecution]
Default: AWSControlTowerExecution
Description: AWS Control Tower execution role name
Type: String
pCreateAWSControlTowerExecutionRole:
AllowedValues: ['true', 'false']
Default: 'true'
Description: Indicates whether the AWS Control Tower Execution role should be created.
Type: String
pSRASolutionName:
AllowedValues: [sra-common-prerequisites]
Default: sra-common-prerequisites
Description: The SRA solution name. The default value is the folder name of the solution
Type: String
pSRASolutionTagKey:
AllowedValues: [sra-solution]
Default: sra-solution
Description: The SRA solution tag key applied to all resources created by the solution that support tagging. The value is the pSRASolutionName.
Type: String
Conditions:
cCreateAWSControlTowerExecutionRole: !Equals [!Ref pCreateAWSControlTowerExecutionRole, 'true']
Resources:
rAWSControlTowerRole:
Condition: cCreateAWSControlTowerExecutionRole
DeletionPolicy: Retain
UpdateReplacePolicy: Retain
Type: AWS::IAM::Role
Metadata:
cfn_nag:
rules_to_suppress:
- id: W28
reason: Specific role name provided for AWS Control Tower
- id: W43
reason: Administrator policy is required for the role
Properties:
RoleName: !Ref pAWSControlTowerExecutionRoleName
AssumeRolePolicyDocument:
Version: 2012-10-17
Statement:
- Action: sts:AssumeRole
Effect: Allow
Principal:
AWS:
- !Sub arn:${AWS::Partition}:iam::${AWS::AccountId}:root
ManagedPolicyArns:
- !Sub arn:${AWS::Partition}:iam::aws:policy/AdministratorAccess
Tags:
- Key: !Ref pSRASolutionTagKey
Value: !Ref pSRASolutionName
Outputs:
oAWSControlTowerExecutionRoleArn:
Condition: cCreateAWSControlTowerExecutionRole
Description: AWS Control Tower Execution Role ARN
Value: !Ref rAWSControlTowerRole