https://pulumi.com logo
Title
c

chilly-noon-57744

04/28/2021, 7:56 AM
Hi Everyone! Does anyone knows what is the longest name a Pulumi resource can have? I have a function on my codebase that uses Hungarian notation generate resource names and I'm worried it might be too long at some point (a resource name would look like
<environment>-<k8s-cluster-name>-<namespace>-<resource name>
).
g

gorgeous-country-43026

04/28/2021, 8:23 AM
I would assume this is a cloud provider specific thing. For example in Azure limits are ridiculously low and in many cases names must be globally unique (meaning, not only in your own subscription but over all subscriptions in whole of Azure)
s

some-flower-64874

04/28/2021, 8:57 AM
Sometimes the limits are (were) tighter in Pulumi than in azure (usually quickly fixed when identified) , other times (storage accounts) its just 😭
c

chilly-noon-57744

04/28/2021, 9:07 AM
Maybe I'm confused. Let me try to give a concrete situation. When I create a new K8s ConfigMap using
new k8s.core.v1.ConfigMap(name, <other args>)
. Is this name the actual configmap name or just a reference to the configmap on Pulumi state? Or maybe both?
g

gorgeous-country-43026

04/28/2021, 9:43 AM
It is not the final name you'll see in kubernetes. Final name is that plus generated suffix
If you wish to override that then provide
{metadata: {name: "your-name"}}
b

billowy-army-68599

04/28/2021, 2:43 PM
@chilly-noon-57744 the property you're referring to is the resource name, which then forms the resource URN. I'm double checking with the team on what the upper bound is. the resource name is used to autogenerate names if you don't explicitly set one, so some providers may throw errors if your names are too long. You unfortunately have to consider both of these when naming resources
It sounds like the upper limit will be about 4MB, which is GRPc's max message size. It'll have to be very long to reach that 🙂
c

chilly-noon-57744

04/29/2021, 7:37 AM
Thank you! I think I won't have any problems then.