I am trying to run congnito via cloudformation and everything works but there is section in cognito as follows:
As you see there is section "Enable identity providers" and I can not find where I can set it to my cognito user pool in cloudformation!
I tried this attributes but it says not supported.
SupportedIdentityProviders
Here is my code for user pool client:
UserPoolClient:
Type: "AWS::Cognito::UserPoolClient"
Properties:
ClientName: !Sub ${project}-client
ExplicitAuthFlows:
- ADMIN_NO_SRP_AUTH
- USER_PASSWORD_AUTH
GenerateSecret: false
UserPoolId: !Ref UserPool
RefreshTokenValidity: 30
and here is my user pool:
UserPool:
Type: "AWS::Cognito::UserPool"
Properties:
UserPoolName: !Sub ${project}-user-pool-test
AutoVerifiedAttributes:
- email
UsernameAttributes:
- email
MfaConfiguration: "OFF"
LambdaConfig:
CustomMessage:
Fn::ImportValue: !Sub ${project}-${EnvironmentApp}-lambda-cognito-custom-message-post
Policies:
PasswordPolicy:
MinimumLength: !Ref MinimumLength
RequireLowercase: !Ref RequireLowercase
RequireNumbers: !Ref RequireNumbers
RequireSymbols: !Ref RequireSymbols
RequireUppercase: !Ref RequireUppercase
Schema:
-
AttributeDataType: String
DeveloperOnlyAttribute: false
Mutable: true
Name: !Sub ${project}-stg
Required: false
-
AttributeDataType: String
DeveloperOnlyAttribute: false
Mutable: true
Name: !Sub zuora-stg
Required: false
-
AttributeDataType: String
DeveloperOnlyAttribute: false
Mutable: true
Name: !Sub salesforce-stg
Required: false
Is it supported in cloud formation? I appreciate any help?
As ASR says, this doesn't seem to be supported in Cloudformation yet.
We ended up trying out Terraform - which does support it e.g.
We've now switched everything to using terraform as it's orders of magnitude easier to understand, read, and write than Cloudformation.
I know that's probably not the answer you want but I hope it helps.
As other answer suggest, this can't be done in CloudFormation natively as of yet. However, as ASR answer advises it is possible to do so through CloudFormation custom resource.
My employer has open sourced its collection of custom resources, including CognitoUserPool and CognitoDomainName (which is also not supported in CloudFormation). Custom resources source code can be found on github
Below are manual directions on setting this up - you can always automate things further by placing Custom Resource backing Lambda in CloudFormation as well.
All commands below are for Mac. You may need to modify base64 flags for other platforms
1. Create IAM Role For Lambda
2. Download lambda source code, upload to your local bucket, and create lambda
3. Optional Test lambda by invoking with test payload
4. Create custom resource in CloudFormation template
For list of all supported properties checkout custom resource JSON schema
I ran into the same problem last month. This property is not supported in CFN yet. So I ended up using CFN custom resource to create the pool client. More here about CFN Custom Resource. Essentially, I have CFN call a Lambda function to create the user pool client (all properties are supported in SDK).