Skip to content

Commit cd15fd5

Browse files
authored
Add log retention (#154)
Adding log retention parameter Improving UI feedback for parameters.
1 parent 31f325c commit cd15fd5

File tree

1 file changed

+59
-14
lines changed

1 file changed

+59
-14
lines changed

template.yaml

+59-14
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Metadata:
5050
# Update the semantic version and run sam publish to publish a new version of your app
5151
SemanticVersion: 1.0.0-rc.10
5252
# best practice is to use git tags for each release and link to the version tag as your source code URL
53-
SourceCodeUrl: https://github.com/awslabs/ssosync/tree/1.0.0-rc.10
53+
SourceCodeUrl: https://github.com/awslabs/ssosync/
5454

5555
Parameters:
5656
FunctionName:
@@ -81,73 +81,108 @@ Parameters:
8181
AllowedValues:
8282
- json
8383
- text
84+
LogRetention:
85+
Type: String
86+
Description: Number of days to retain Logs for, leave empty to retain them indefinitely
87+
Default: ""
88+
AllowedPattern: '(?!.*\s)|/d'
8489
TimeOut:
8590
Type: Number
8691
Description: Timeout for the Lambda function
8792
Default: 300
8893
MinValue: 1
8994
MaxValue: 900
9095

96+
9197
GoogleCredentials:
9298
Type: String
93-
Description: Credentials to log into Google (content of credentials.json)
99+
Description: |
100+
Credentials to log into Google (content of credentials.json)
101+
ConstraintDescription: |
102+
You should save this information when following this setup https://developers.google.com/admin-sdk/directory/v1/guides/delegation
94103
NoEcho: true
95104
GoogleAdminEmail:
96105
Type: String
97-
Description: Google Admin email
106+
Description: |
107+
Google Admin email
108+
ConstraintDescription: |
109+
This is a use with admin authority on your Google Directory, you will have used this when following this setup https://developers.google.com/admin-sdk/directory/v1/guides/delegation
98110
NoEcho: true
99111
SCIMEndpointUrl:
100112
Type: String
101-
Description: AWS IAM Identity Center - SCIM Endpoint Url
102-
NoEcho: true
113+
Description: |
114+
AWS IAM Identity Center - SCIM Endpoint Url
103115
AllowedPattern: "https://scim.(us(-gov)?|ap|ca|cn|eu|sa)-(central|(north|south)?(east|west)?)-([0-9]{1}).amazonaws.com/(.*)-([a-z0-9]{4})-([a-z0-9]{4})-([a-z0-9]{12})/scim/v2/"
116+
ConstraintDescription: |
117+
You should save this information when following this setup https://docs.aws.amazon.com/singlesignon/latest/userguide/provision-automatically.html
118+
NoEcho: true
104119
SCIMEndpointAccessToken:
105120
Type: String
106-
Description: AWS IAM Identity Center - SCIM AccessToken
121+
Description: |
122+
AWS IAM Identity Center - SCIM AccessToken
123+
ConstraintDescription: |
124+
You should save this information when following this setup https://docs.aws.amazon.com/singlesignon/latest/userguide/provision-automatically.html
107125
NoEcho: true
108126
Region:
109127
Type: String
110-
Description: AWS Region where AWS IAM Identity Center is enabled
128+
Description: |
129+
AWS Region where AWS IAM Identity Center is enabled
130+
ConstraintDescription: |
131+
You can find this value on the settings page of the IAM Identity Center console page
111132
AllowedPattern: '(us(-gov)?|ap|ca|cn|eu|sa)-(central|(north|south)?(east|west)?)-\d'
112133
IdentityStoreID:
113134
Type: String
114-
Description: Identifier of Identity Store in AWS IAM Identity Center
135+
Description: |
136+
Identifier of Identity Store in AWS IAM Identity Center
137+
ConstraintDescription: |
138+
You can find this value on the settings page of the IAM Identity Center console page
115139
NoEcho: true
116140
AllowedPattern: 'd-[1-z0-9]{10}'
117141

118142
GoogleUserMatch:
119143
Type: String
120144
Description: |
121-
Google Workspace user filter query parameter, example: 'name:John* email:admin*', see: https://developers.google.com/admin-sdk/directory/v1/guides/search-users
145+
Google Workspace user filter query parameter, example: 'name:John* email:admin*', leave empty if you do not wish to pass this parameter
146+
ConstraintDescription: |
147+
The parameter needs to be compliant with the Google admin-sdk api, https://developers.google.com/admin-sdk/directory/v1/guides/search-users
122148
Default: ""
123149
AllowedPattern: '(?!.*\s)|(name|Name|NAME)(:([a-zA-Z0-9]{1,64})(\*))|(name|Name|NAME)(=([a-zA-Z0-9 ]{1,64}))|(email|Email|EMAIL)(:([a-zA-Z0-9.-_]{1,64})(\*))|(email|Email|EMAIL)(=([a-zA-Z0-9.-_]{1,64})@([a-zA-Z0-9.-]{5,260}))'
124150
GoogleGroupMatch:
125151
Type: String
126152
Description: |
127-
Google Workspace group filter query parameter, example: 'name:Admin* email:aws-*', see: https://developers.google.com/admin-sdk/directory/v1/guides/search-groups
153+
Google Workspace group filter query parameter, example: 'name:Admin* email:aws-*', leave empty if you do not wish to pass this parameter
154+
ConstraintDescription: |
155+
The parameter needs to be compliant with the Google admin-sdk api, see: https://developers.google.com/admin-sdk/directory/v1/guides/search-groups
128156
Default: 'name:AWS*'
129157
AllowedPattern: '(?!.*\s)|(name|Name|NAME)(:([a-zA-Z0-9]{1,64})\*)|(name|Name|NAME)(=([a-zA-Z0-9 ]{1,64}))|(email|Email|EMAIL)(:([a-zA-Z0-9.-_]{1,64})\*)|(email|Email|EMAIL)(=([a-zA-Z0-9.-_]{1,64})@([a-zA-Z0-9.-]{5,260}))'
130158
IgnoreGroups:
131159
Type: String
132160
Description: |
133-
Ignore these Google Workspace groups, leave empty if not required
161+
Do NOT sync these Google Workspace groups into IAM Identity Center, leave empty if not required
162+
ConstraintDescription: |
163+
This should be a comma separated list of group names
134164
Default: ""
135-
AllowedPattern: '(?!.*\s)|([0-9a-zA-Z-= _]*)(,[0-9a-zA-Z-=@. _]*)*'
165+
AllowedPattern: '(?!.*\s)|(["0-9a-zA-Z-=@. _]*)(,["0-9a-zA-Z-=@. _]*)*'
136166
IgnoreUsers:
137167
Type: String
138168
Description: |
139169
Ignore these Google Workspace users, leave empty if not required
170+
ConstraintDescription: |
171+
This should be a comma separated list of group names
140172
Default: ""
141173
AllowedPattern: '(?!.*\s)|([0-9a-zA-Z-= _]*)(,[0-9a-zA-Z-=@. _]*)*'
142174
IncludeGroups:
143175
Type: String
144176
Description: |
145177
Include only these Google Workspace groups, leave empty if not required. (Only applicable for SyncMethod user_groups)
178+
ConstraintDescription: |
179+
This should be a comma separated list of group names
146180
Default: ""
147181
AllowedPattern: '(?!.*\s)|([0-9a-zA-Z-= _]*)(,[0-9a-zA-Z-=@. _]*)*'
148182
SyncMethod:
149183
Type: String
150-
Description: Sync method to use
184+
Description: |
185+
Which sync method do you want to use with ssosync?
151186
Default: groups
152187
AllowedValues:
153188
- groups
@@ -161,7 +196,8 @@ Conditions:
161196
SetIgnoreGroups: !Not [!Equals [!Ref "IgnoreGroups", ""]]
162197
SetIgnoreUsers: !Not [!Equals [!Ref "IgnoreUsers", ""]]
163198
SetIncludeGroups: !Or [!Not [!Equals [!Ref "IncludeGroups", ""]], !Equals [!Ref "SyncMethod", groups]]
164-
199+
NotIndefinite: !Not [!Equals [!Ref "LogRetention", ""]]
200+
165201
Resources:
166202
SSOSyncFunction:
167203
Type: AWS::Serverless::Function
@@ -231,6 +267,15 @@ Resources:
231267
Enabled: !If [OnSchedule, false, true]
232268
Schedule: !If [OnSchedule, !Ref ScheduleExpression, "rate(15 minutes)"]
233269

270+
# Explicit log group that refers to the Lambda function
271+
LogGroup:
272+
Type: AWS::Logs::LogGroup
273+
Condition: NotIndefinite
274+
Properties:
275+
LogGroupName: !Sub "/aws/lambda/${SSOSyncFunction}"
276+
# Explicit retention time
277+
RetentionInDays: !Ref LogRetention
278+
234279
AWSGoogleCredentialsSecret:
235280
Type: "AWS::SecretsManager::Secret"
236281
Properties:

0 commit comments

Comments
 (0)