Skip to content

Commit

Permalink
Update packages/@aws-cdk/aws-apprunner-alpha/lib/auto-scaling-configu…
Browse files Browse the repository at this point in the history
…ration.ts

Co-authored-by: Luca Pizzini <[email protected]>
  • Loading branch information
mazyu36 and lpizzinidev authored Jun 2, 2024
1 parent b161ed7 commit 50fc0d3
Showing 1 changed file with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,12 @@ export class AutoScalingConfiguration extends cdk.Resource implements IAutoScali
physicalName: props.autoScalingConfigurationName,
});

if (props.autoScalingConfigurationName !== undefined) {
if (props.autoScalingConfigurationName.length < 4 || props.autoScalingConfigurationName.length > 32) {
throw new Error(`autoScalingConfigurationName must be between 4 and 32 characters long, but it has ${props.autoScalingConfigurationName.length} characters.`);
}

if (!/^[A-Za-z0-9][A-Za-z0-9\-_]{3,31}$/.test(props.autoScalingConfigurationName)) {
throw new Error(`autoScalingConfigurationName ${props.autoScalingConfigurationName} must start with a letter or number, and can contain only letters, numbers, hyphens, and underscores.`);
}
if (
props.autoScalingConfigurationName !== undefined &&
!cdk.Token.isUnresolved(props.autoScalingConfigurationName) &&
!/^[A-Za-z0-9][A-Za-z0-9\-_]{3,31}$/.test(props.autoScalingConfigurationName)
) {
throw new Error(`autoScalingConfigurationName must match the ^[A-Za-z0-9][A-Za-z0-9\-_]{3,31}$ pattern, got ${props.autoScalingConfigurationName}`);
}

if (props.minSize !== undefined && !cdk.Token.isUnresolved(props.minSize) && (props.minSize < 1 || props.minSize > 25)) {
Expand Down

0 comments on commit 50fc0d3

Please sign in to comment.