forked from awslabs/ssosync
-
Notifications
You must be signed in to change notification settings - Fork 0
/
template.yaml
218 lines (205 loc) · 6.67 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
AWSTemplateFormatVersion: "2010-09-09"
Transform: AWS::Serverless-2016-10-31
Metadata:
AWS::CloudFormation::Interface:
ParameterGroups:
- Label:
default: "General"
Parameters:
- GoogleCredentials
- GoogleAdminEmail
- SCIMEndpointUrl
- SCIMEndpointAccessToken
- Region
- IdentityStoreID
- Label:
default: "Advanced Configuration"
Parameters:
- SyncMethod
- GoogleUserMatch
- GoogleGroupMatch
- LogLevel
- LogFormat
- ScheduleExpression
- IgnoreUsers
- IgnoreGroups
- IncludeGroups
AWS::ServerlessRepo::Application:
Name: ssosync
Description: Helping you populate AWS SSO directly with your Google Apps users.
Author: Sebastian Doell
SpdxLicenseId: Apache-2.0
# paths are relative to .aws-sam/build directory
LicenseUrl: LICENSE
ReadmeUrl: SAR.md
Labels: [serverless, sso, lambda, scim]
HomePageUrl: https://github.com/awslabs/ssosync
# Update the semantic version and run sam publish to publish a new version of your app
SemanticVersion: 1.0.0-rc.10
# best practice is to use git tags for each release and link to the version tag as your source code URL
SourceCodeUrl: https://github.com/awslabs/ssosync/tree/1.0.0-rc.10
Parameters:
ScheduleExpression:
Type: String
Description: Schedule for trigger the execution of ssosync (see CloudWatch schedule expressions)
Default: rate(15 minutes)
LogLevel:
Type: String
Description: Log level for Lambda function logging
Default: warn
AllowedValues:
- panic
- fatal
- error
- warn
- info
- debug
- trace
LogFormat:
Type: String
Description: Log format for Lambda function logging
Default: json
AllowedValues:
- json
- text
GoogleCredentials:
Type: String
Description: Credentials to log into Google (content of credentials.json)
NoEcho: true
GoogleAdminEmail:
Type: String
Description: Google Admin email
NoEcho: true
SCIMEndpointUrl:
Type: String
Description: AWS SSO SCIM Endpoint Url
NoEcho: true
SCIMEndpointAccessToken:
Type: String
Description: AWS SSO SCIM AccessToken
NoEcho: true
Region:
Type: String
Description: AWS Region where AWS SSO is enabled
NoEcho: true
IdentityStoreID:
Type: String
Description: Identifier of Identity Store in AWS SSO
NoEcho: true
GoogleUserMatch:
Type: String
Description: |
Google Workspace user filter query parameter, example: 'name:John* email:admin*', see: https://developers.google.com/admin-sdk/directory/v1/guides/search-users
GoogleGroupMatch:
Type: String
Description: |
Google Workspace group filter query parameter, example: 'name:Admin* email:aws-*', see: https://developers.google.com/admin-sdk/directory/v1/guides/search-groups
IgnoreGroups:
Type: String
Description: |
Ignore these Google Workspace groups
IgnoreUsers:
Type: String
Description: |
Ignore these Google Workspace users
IncludeGroups:
Type: String
Description: |
Include only these Google Workspace groups. (Only applicable for SyncMethod user_groups)
SyncMethod:
Type: String
Description: Sync method to use
Default: groups
AllowedValues:
- groups
- users_groups
Resources:
SSOSyncFunction:
Type: AWS::Serverless::Function
Properties:
Runtime: go1.x
Handler: dist/ssosync_linux_amd64_v1/ssosync
Timeout: 300
Environment:
Variables:
SSOSYNC_LOG_LEVEL: !Ref LogLevel
SSOSYNC_LOG_FORMAT: !Ref LogFormat
SSOSYNC_GOOGLE_CREDENTIALS: !Ref AWSGoogleCredentialsSecret
SSOSYNC_GOOGLE_ADMIN: !Ref AWSGoogleAdminEmail
SSOSYNC_SCIM_ENDPOINT: !Ref AWSSCIMEndpointSecret
SSOSYNC_SCIM_ACCESS_TOKEN: !Ref AWSSCIMAccessTokenSecret
SSOSYNC_REGION: !Ref AWSRegionSecret
SSOSYNC_IDENTITY_STORE_ID: !Ref AWSIdentityStoreIDSecret
SSOSYNC_USER_MATCH: !Ref GoogleUserMatch
SSOSYNC_GROUP_MATCH: !Ref GoogleGroupMatch
SSOSYNC_SYNC_METHOD: !Ref SyncMethod
SSOSYNC_IGNORE_GROUPS: !Ref IgnoreGroups
SSOSYNC_IGNORE_USERS: !Ref IgnoreUsers
SSOSYNC_INCLUDE_GROUPS: !Ref IncludeGroups
Policies:
- Statement:
- Sid: SSMGetParameterPolicy
Effect: Allow
Action:
- "secretsmanager:Get*"
Resource:
- !Ref AWSGoogleCredentialsSecret
- !Ref AWSGoogleAdminEmail
- !Ref AWSSCIMEndpointSecret
- !Ref AWSSCIMAccessTokenSecret
- !Ref AWSRegionSecret
- !Ref AWSIdentityStoreIDSecret
- Version: '2012-10-17'
Statement:
- Sid: IdentityStoreAccesPolicy
Effect: Allow
Action:
- "identitystore:DeleteUser"
- "identitystore:CreateGroup"
- "identitystore:CreateGroupMembership"
- "identitystore:ListGroups"
- "identitystore:ListUsers"
- "identitystore:ListGroupMemberships"
- "identitystore:IsMemberInGroups"
- "identitystore:GetGroupMembershipId"
- "identitystore:DeleteGroupMembership"
- "identitystore:DeleteGroup"
Resource:
- "*"
Events:
SyncScheduledEvent:
Type: Schedule
Name: AWSSyncSchedule
Properties:
Enabled: true
Schedule: !Ref ScheduleExpression
AWSGoogleCredentialsSecret:
Type: "AWS::SecretsManager::Secret"
Properties:
Name: SSOSyncGoogleCredentials
SecretString: !Ref GoogleCredentials
AWSGoogleAdminEmail:
Type: "AWS::SecretsManager::Secret"
Properties:
Name: SSOSyncGoogleAdminEmail
SecretString: !Ref GoogleAdminEmail
AWSSCIMEndpointSecret: # This can be moved to custom provider
Type: "AWS::SecretsManager::Secret"
Properties:
Name: SSOSyncSCIMEndpointUrl
SecretString: !Ref SCIMEndpointUrl
AWSSCIMAccessTokenSecret: # This can be moved to custom provider
Type: "AWS::SecretsManager::Secret"
Properties:
Name: SSOSyncSCIMAccessToken
SecretString: !Ref SCIMEndpointAccessToken
AWSRegionSecret:
Type: "AWS::SecretsManager::Secret"
Properties:
Name: SSOSyncRegion
SecretString: !Ref Region
AWSIdentityStoreIDSecret:
Type: "AWS::SecretsManager::Secret"
Properties:
Name: SSOSyncIdentityStoreID
SecretString: !Ref IdentityStoreID