We are maintaining Cognito App clients via cdk. When altering App client attributes we have noticed that sometimes CloudFormation recreates App Clients and sometimes just modifies existing app client without recreating new one.
Recreating app clients is a problem in our case since there are external applications that use authentication and a changed App client id breaks authentication.
For example when adding new optional attribute generateSecret with value generateSecret:false (default value) CF decided to re-create App client. When changing i.e token expiration values re-creation is not going to happen.
How to prevent re-creation OR how to identify cases when re-creation is going to happen beforehand?