Open ubaniabalogun opened 4 years ago
:+1: and go further
This has just bitten me too, all my services are {{basename}}-whateveritsdoing - so I always have hyphens in the service name
Someone on board? I really need to get this improvement.
Hey guys, please, check https://github.com/hybridless/serverless-ecs-plugin, will actively support you there :)
Serverless deployment with the plugin fails when the serverless application name is non-alphanumeric. For example, the below serverless.yaml would not successfully deploy when the plugin is configured
It will fail with error
This is likely happening because the plugin is concatenating the raw service name with the
clusterName
property to form thenamePrefix
as linked below and serverless is attempting to use thatnamePrefix
as the Resource name for the Cloudformation (CF) stack.https://github.com/honerlaw/serverless-fargate-plugin/blob/e2bbdb370b583fff6cee8e9833dc28304c6afbbe/src/resources/cluster.ts#L15
CF however, requires alphanumeric names for Resource Names.
Raising this as an issue as non-alphanumeric service names above are valid in serverless.yaml files, and shouldn't be used to prefix strings that may be used as Resource Names in CF.
A couple of ways I can think of addressing this are: a) Auto substituting non-alphanumeric values in the
namePrefix
to make it alphanumeric before use (this could break existing deployments using the plugin) b) Introducing ausePrefix
flag that defaults to true but can be set to false if a user doesn't want clusterName prefixedIf either of those options sounds appealing or you have alternative options you'd like to explore, please let me know and I'd be happy to take a swing at creating a PR for the fix