I have this role attachment resource that as is, deploys just fine:
CognitoIdentityPoolRoleAttachment:
DependsOn: [ CognitoIdentityPool, CognitoIdentityPoolAuthRole, CognitoIdentityPoolUnauthRole ]
Type: "AWS::Cognito::IdentityPoolRoleAttachment"
Properties:
IdentityPoolId: !Ref CognitoIdentityPool
RoleMappings:
'cognito-idp.us-west-2.amazonaws.com/us-west-2_naEXQTLxD:44rd7mu8dncna2kqimd74f7u98':
Type: Token
AmbiguousRoleResolution: AuthenticatedRole
Roles:
unauthenticated: !GetAtt CognitoIdentityPoolUnauthRole.Arn
authenticated: !GetAtt CognitoIdentityPoolAuthRole.Arn
However, as you can see I have a RoleMappings property that is actually my CognitoUserPool ProviderName appended to my Cognito User Pool Client ID, so I need this property to have a dynamic name.
Looking over the docs, however, I can't find a way to actually use intrinsic functions on an object key. When I try this:
RoleMappings:
!Sub '${CognitoUserPool.ProviderName}:${CognitoUserPoolClient}':
Type: Token
AmbiguousRoleResolution: AuthenticatedRole
I get an invalid template error. Is there a special syntax I'm missing that allows you to define keys instead of properties? Or am I going to have to do this some other way?