-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@aws-cdk_aws-apprunner-alpha: Invalid cpu or memory should be validated #25872
Comments
I believe we should first consider using existing options in the enum-like class as below as they are all valid values. The aws-cdk/packages/@aws-cdk/aws-apprunner-alpha/lib/service.ts Lines 31 to 55 in 830e6d3
|
I agree.
Since only unit types (e.g. If I think what we can do now is one of the following
|
I just thought that, as the significance of existence of |
In that case, the enum options for numeric types may not be necessary; it is also difficult to know how to use them differently from the enum options for unit types. Then, what to do is |
Agree. We would love to review your PR when it's ready. |
Thank you, I'll try it that way. ( |
Hi! I have submitted a PR, please review. |
Sorry to jump into an issue that may only be tangentially related, but I'm currently receiving validation errors when trying to set resource allocation using the enum-like classes provided by the package - is that expected? The following service creation: new apprunner.Service(this, getResourceName(`apprunner-service`, props.stage), {
cpu: apprunner.Cpu.TWO_VCPU,
memory: apprunner.Memory.SIX_GB,
source: apprunner.Source.fromAsset({
asset: dockerImage,
imageConfiguration: {
port: 3000,
environmentVariables: {
// some extra config here
},
},
}),
}); Results in the following error from CloudFormation -
Is that expected from the way that I'm providing the values do you know please? |
I was able to deploy with the above specs (Cpu.TWO_VCPU and Memory.SIX_GB) using the enum-like classes.
|
This PR adds the same validation for the App Runner's CPU and Memory values as [CloudFormation's input patterns](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apprunner-service-instanceconfiguration.html#cfn-apprunner-service-instanceconfiguration-cpu). Closes #25872 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
|
Describe the feature
App Runner's CPU and Memory have a fixed input patterns in CloudFormation.
However, in CDK's L2 Construct (alpha), the input format is free (like
Some vCPU
). Tests are as follows (packages/@aws-cdk/aws-apprunner-alpha/test/service.test.ts).I would like to validate an invalid format before deploy.
Use Case
Incorrect values can be detected at the synth stage before deployment.
Proposed Solution
Create a private method for validation and call it at the constructor in the
Service
class.Other Information
CFn output is the following message when deploy errors.
Properties validation failed for resource AppRunnerConstructAppRunnerService123456789 with message: #/InstanceConfiguration/Cpu: failed validation constraint for keyword [pattern]
Acknowledgements
CDK version used
v2.82.0
Environment details (OS name and version, etc.)
MacOS Ventura 13.2
The text was updated successfully, but these errors were encountered: