|
122 | 122 | } |
123 | 123 | }, |
124 | 124 |
|
125 | | - "LambdaCognitoExecutionRole": { |
| 125 | + "LambdaCreateCognitoExecutionRole": { |
126 | 126 | "Type": "AWS::IAM::Role", |
127 | 127 | "Properties": { |
128 | 128 | "AssumeRolePolicyDocument": { |
|
158 | 158 | } |
159 | 159 | }, |
160 | 160 |
|
| 161 | + "LambdaUpdateCognitoExecutionRole": { |
| 162 | + "Type": "AWS::IAM::Role", |
| 163 | + "Properties": { |
| 164 | + "AssumeRolePolicyDocument": { |
| 165 | + "Version": "2012-10-17", |
| 166 | + "Statement": [{ |
| 167 | + "Effect": "Allow", |
| 168 | + "Principal": {"Service": ["lambda.amazonaws.com"]}, |
| 169 | + "Action": ["sts:AssumeRole"] |
| 170 | + }] |
| 171 | + }, |
| 172 | + "Path": "/", |
| 173 | + "Policies": [{ |
| 174 | + "PolicyName": "root", |
| 175 | + "PolicyDocument": { |
| 176 | + "Version": "2012-10-17", |
| 177 | + "Statement": [{ |
| 178 | + "Effect": "Allow", |
| 179 | + "Action": ["logs:CreateLogGroup","logs:CreateLogStream","logs:PutLogEvents"], |
| 180 | + "Resource": "arn:aws:logs:*:*:*" |
| 181 | + }, |
| 182 | + { |
| 183 | + "Effect": "Allow", |
| 184 | + "Action": ["cognito-identity:CreateIdentityPool","cognito-identity:SetIdentityPoolRoles","cognito-identity:UpdateIdentityPool"], |
| 185 | + "Resource": "*" |
| 186 | + }, |
| 187 | + { |
| 188 | + "Effect": "Allow", |
| 189 | + "Action": ["iam:putRolePolicy"], |
| 190 | + "Resource": {"Ref": "LambdaUserRole"} |
| 191 | + }, |
| 192 | + { |
| 193 | + "Effect": "Allow", |
| 194 | + "Action": ["iam:passRole"], |
| 195 | + "Resource": [{ "Fn::GetAtt" : ["CognitoServerlessBlogAuthenticatedRole", "Arn"] }, |
| 196 | + { "Fn::GetAtt" : ["CognitoServerlessBlogUnauthenticatedRole", "Arn"] }] |
| 197 | + }] |
| 198 | + } |
| 199 | + }] |
| 200 | + } |
| 201 | + }, |
| 202 | + |
161 | 203 | "CreateCognitoPoolResource": { |
162 | 204 | "Type": "Custom::CreateCognitoPoolResource", |
163 | 205 | "Properties": { |
|
175 | 217 | }, |
176 | 218 |
|
177 | 219 | "AddCognitoIdentityPool": { |
178 | | - "DependsOn": "LambdaCognitoExecutionRole", |
| 220 | + "DependsOn": "LambdaCreateCognitoExecutionRole", |
179 | 221 | "Type": "AWS::Lambda::Function", |
180 | 222 | "Properties": { |
181 | 223 | "Handler": "index.handler", |
182 | 224 | "Runtime": "nodejs", |
183 | | - "Role": { "Fn::GetAtt" : ["LambdaCognitoExecutionRole", "Arn"] }, |
| 225 | + "Role": { "Fn::GetAtt" : ["LambdaCreateCognitoExecutionRole", "Arn"] }, |
184 | 226 | "Code": { |
185 | 227 | "ZipFile": { |
186 | 228 | "Fn::Join": ["\n", [ |
|
253 | 295 | }, |
254 | 296 |
|
255 | 297 | "UpdateCognitoIdentityPool": { |
256 | | - "DependsOn": "LambdaCognitoExecutionRole", |
| 298 | + "DependsOn": "LambdaUpdateCognitoExecutionRole", |
257 | 299 | "Type": "AWS::Lambda::Function", |
258 | 300 | "Properties": { |
259 | 301 | "Handler": "index.handler", |
260 | 302 | "Runtime": "nodejs", |
261 | | - "Role": { "Fn::GetAtt" : ["LambdaCognitoExecutionRole", "Arn"] }, |
| 303 | + "Role": { "Fn::GetAtt" : ["LambdaUpdateCognitoExecutionRole", "Arn"] }, |
262 | 304 | "Code": { |
263 | 305 | "ZipFile": { |
264 | 306 | "Fn::Join": ["\n", [ |
|
0 commit comments