-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.yaml
119 lines (113 loc) · 3.58 KB
/
template.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
AWSTemplateFormatVersion: 2010-09-09
Transform: AWS::Serverless-2016-10-31
Resources:
GetOrgDetailsFunction:
Type: AWS::Serverless::Function
Metadata:
cfn-lint:
config:
ignore_checks:
- E3002 # Need to ignore cfn-lint illegal function check due to usage of !Rain::Embed
cfn_nag:
rules_to_suppress:
- id: W89
reason: VPC not required.
- id: W92
reason: Reserved Concurrency not required.
- id: W11
reason: Resource level permissions not possible on this API.
Properties:
Runtime: python3.12
Handler: index.handler
Architectures:
- arm64
Policies:
- Version: 2012-10-17
Statement:
- Effect: Allow
Action:
- organizations:ListRoots
- organizations:DescribeOrganization
Resource: "*"
InlineCode: !Rain::Embed functions/get_org_details.py
OrgDetails:
Type: Custom::OrganizationRootId
Properties:
ServiceToken: !GetAtt GetOrgDetailsFunction.Arn
StackSet:
Type: AWS::CloudFormation::StackSet
Metadata:
cfn-lint:
config:
ignore_checks:
- E3002 # Need to ignore cfn-lint illegal function check due to usage of !Rain::Embed
Properties:
StackSetName: !Sub ${AWS::StackName}-StackSet
PermissionModel: SERVICE_MANAGED
StackInstancesGroup:
- DeploymentTargets:
OrganizationalUnitIds:
- !Ref OrgDetails
Regions:
- !Ref AWS::Region
AutoDeployment:
Enabled: True
RetainStacksOnAccountRemoval: False
ManagedExecution:
Active: True
OperationPreferences:
MaxConcurrentPercentage: 100
FailureTolerancePercentage: 100
RegionConcurrencyType: PARALLEL
Capabilities:
- CAPABILITY_IAM
- CAPABILITY_NAMED_IAM
CallAs: DELEGATED_ADMIN
TemplateBody: !Rain::Embed stackset-pkg.yaml
ShareDocumentFunction:
Type: AWS::Serverless::Function
Metadata:
cfn-lint:
config:
ignore_checks:
- E3002 # Need to ignore cfn-lint illegal function check due to usage of !Rain::Embed
cfn_nag:
rules_to_suppress:
- id: W89
reason: VPC not required.
- id: W92
reason: Reserved Concurrency not required.
- id: W11
reason: Resource level permissions not possible on this API.
Properties:
Runtime: python3.12
Handler: index.handler
Timeout: 30
Architectures:
- arm64
Policies:
- Version: 2012-10-17
Statement:
- Effect: Allow
Action:
- organizations:ListAccounts
Resource: "*"
- Effect: Allow
Action:
- ssm:ModifyDocumentPermission
Resource: !Sub arn:${AWS::Partition}:ssm:${AWS::Region}:${AWS::AccountId}:document/${AWS::StackName}-*Remediation-*
InlineCode: !Rain::Embed functions/share_document.py
ConformancePack:
Type: AWS::Config::OrganizationConformancePack
Metadata:
cfn-lint:
config:
ignore_checks:
- E3002 # Need to ignore cfn-lint illegal function check due to usage of !Rain::Embed
DependsOn: StackSet
Properties:
OrganizationConformancePackName: Cost-Optimization
ExcludedAccounts:
- !GetAtt OrgDetails.MasterAccountId
ConformancePackInputParameters: []
TemplateBody: !Rain::Embed conformancepack-build.yaml