File tree Expand file tree Collapse file tree 1 file changed +20
-15
lines changed
Expand file tree Collapse file tree 1 file changed +20
-15
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,15 @@ resource "aws_iam_role" "cognito_unauth_role" {
3131 Principal : {
3232 Federated : " cognito-identity.amazonaws.com"
3333 },
34- Action = " sts:AssumeRole"
34+ Action = " sts:AssumeRoleWithWebIdentity" ,
35+ Condition = {
36+ StringEquals = {
37+ " cognito-identity.amazonaws.com:aud" = " ${ local . current_region } :${ aws_cognito_identity_pool . rum_identity_pool [0 ]. id } "
38+ },
39+ " ForAnyValue:StringLike" = {
40+ " cognito-identity.amazonaws.com:amr" = " unauthenticated"
41+ }
42+ }
3543 }
3644 ]
3745 })
@@ -41,19 +49,16 @@ resource "aws_iam_policy" "cognito_access_policy" {
4149 name = " ${ terraform . workspace } -cognito-access-policy"
4250 description = " Policy for unauthenticated Cognito identities"
4351
44- policy = jsonencode ({
45- Version = " 2012-10-17" ,
46- Statement = [
47- {
48- Effect = " Allow" ,
49- Action = [
50- " mobileanalytics:PutEvents" ,
51- " cognito-sync:*" ,
52- " cognito-identity:*" ,
53- ],
54- Resource = " *"
55- }
56- ]
52+ policy = jsonencode (
53+ {
54+ " Version" : " 2012-10-17" ,
55+ " Statement" : [
56+ {
57+ " Effect" : " Allow" ,
58+ " Action" : " rum:PutRumEvents" ,
59+ " Resource" : " arn:aws:rum:${ local . current_region } :${ local . current_account_id } :appmonitor/${ terraform . workspace } -app-monitor"
60+ }
61+ ]
5762 })
5863}
5964
@@ -125,4 +130,4 @@ resource "aws_rum_app_monitor" "app_monitor" {
125130 tags = {
126131 ServiceRole = aws_iam_role.rum_service_role.arn
127132 }
128- }
133+ }
You can’t perform that action at this time.
0 commit comments