-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Description
Describe the bug
If your stack name begins with "aws", "ecs", or "fargate", you will receive the following error when creating an ASG capacity provider if you don't specify a capacity provider name.
"Invalid request provided: CreateCapacityProvider error: The specified capacity provider name is invalid. Up to 255 characters are allowed, including letters (
upper and lowercase), numbers, underscores, and hyphens. The name cannot be prefixed with "aws", "ecs", or "fargate". Specify a valid name and try again."
Expected Behavior
I expected the ASG capacity provider to be created without issue no matter what the stack name is.
Current Behavior
I described it pretty well above, but if you have any specific questions. I can't think of anything more relevant that would apply here.
Reproduction Steps
Init a new stack with the CDK in a directory that starts with "aws-"
Create an ASG capacity provider, but don't specify the "capacityProviderName" property so the CDK will autogenerate a name for you
Deploy it
Possible Solution
Maybe don't let a project be initialized with illegal keywords. You could also do a simple regex check when creating the ASG capacity provider to see if the autogenerated name contains those illegal keywords and either remove them or add some other word that is valid.
Additional Information/Context
If we are going to ban the words aws across the board then the CDK should specify that so a linter can catch things like that.
CDK CLI Version
2.128.0 (build d995261)
Framework Version
No response
Node.js Version
v20.10.0
OS
Linux fedora 6.7.4-200.fc39.x86_64 #1 SMP PREEMPT_DYNAMIC Mon Feb 5 22:21:14 UTC 2024 x86_64 GNU/Linux
Language
TypeScript
Language Version
No response
Other information
No response