I've asked this before but I cannot figure out the...
# random
t
I've asked this before but I cannot figure out the naming conventions with cdk. Here are some scenarios. If I name my stack
MyStack
it gets deployed as dev-app-MyStack which maybe suggests I should name it
my-stack
But then if I use hyphenated case for my constructs eg
my-func
the hyphens get removed in some cases because some constructs don't allow hyphens in the name This is a small minor thing but I can't help but be annoyed by it. What is everyone else doing?
a
I hate current naming convention.
The functions and roles and such seems to follow other naming convention.
s
the PascalCase names are just internal in the SST code, for me.
MyStack
. but in AWS, it’s
dev-my-stack-*
and my Lambda functions are named like
dev-my-stack-someFuncName
a
You put the name of the stack in the function too?
s
yep, because I have 4 stacks. so it helps me sort through my massive list of functions and find stuff
a
Yeah I have bunch of stack too.
I don’t put the stack name but a name that works with the stack.
I have…
TasksApiStack
, and my function has
dev-tasks-findAll
.
But maybe is better to name my func with the stack name.
s
whatever works for you! 🙂 but I do like talking to other devs about naming conventions & other best practices. sometimes I’ll pick up a new way of doing something that makes me more efficient
a
Yeah my worry is the char limit on lambda func name.
Because I also have the name of my company on the name.
Still trying to find the correct name convention.
j
Also always seem to be going down rabbit holes with naming conventions. Where possible I prefer to avoid the CDK default and have currently settled on
project-stage-NameOfResourceHere
. Project could also be synonymous with a stack or logical grouping of stacks. On this note, what are you guys doing with REST API’s (ApiGatewayV1Api in particular)? It looks like SST is enforcing the restApiName to
root.logicalPrefixedName(id)
, but am not sure if I am missing something?