https://pulumi.com logo
Title
c

cuddly-smartphone-89735

04/15/2020, 3:53 PM
Say, I have a
ComponentResource
, that slowly grows too big to be all in one file. Is it good practice to structure parts of the resources in another file using a function or plain class, so that the "internal" structure is not reflected in the pulumi state, but I still get to make it more readable? Would you prefer a function or a plain class? Or a whole other concept for this?
g

gorgeous-egg-16927

04/15/2020, 4:20 PM
I often use functions for this. You can check out our EKS package for some examples of this: https://github.com/pulumi/pulumi-eks/blob/master/nodejs/eks/cluster.ts#L1135 You’ll notice that this file is still quite long, but all those supporting functions could be moved to separate files.
c

cuddly-smartphone-89735

04/16/2020, 1:36 PM
Thanks @gorgeous-egg-16927 🙂