lib/plugins/aws/customResources/resources/cognitoUserPool/lib/userPool.js/updateConfiguration
function updateConfiguration(config) {
  const { lambdaArn, userPoolConfigs, region } = config;
  const cognito = new CognitoIdentityServiceProvider({ region });

  return getConfiguration(config).then(res => {
    const UserPoolId = res.UserPool.Id;
    let { LambdaConfig } = res.UserPool;
    // remove configurations for this specific function
    LambdaConfig = Object.keys(LambdaConfig).reduce((accum, key) => {
      if (LambdaConfig[key] === lambdaArn) delete accum[key];
      return accum;
    }, LambdaConfig);

    userPoolConfigs.forEach(poolConfig => {
      LambdaConfig[poolConfig.Trigger] = lambdaArn;
    });

    const updatedConfig = getUpdateConfigFromCurrentSetup(res.UserPool);
    Object.assign(updatedConfig, {
      UserPoolId,
      LambdaConfig,
    });

    return cognito.updateUserPool(updatedConfig).promise();
  });
}