This topic contains 2 replies, has 2 voices, and was last updated by
February 10, 2016 at 3:05 pm #35145ParticipantTopics: 29Replies: 125Points: 0Rank: Member
So I'm about to "push" a module out into the wild, but it can be a single module with multiple resources or multiple modules depending on how I slice things. From a "formality" perspective I'm curious as to guidelines as to when to split and when to combine things.
What was written:
With some guidance from Don Jones in another thread, I wrote a DSC Module/Resource that will compare the local configuration certificate thumbprint against the local computer store (with filters so the admin can define what the "best" cert to use is), and if the two don't match it copies the public key of the cert to a UNC path for build-bots (or whatever you like to call those boxes you generate the mofs on) to leverage.
The other resource isn't a DSC resource at all: its a function that takes in the configurationdata hashtable and modifies the nodes by adding thumbprint and cert path information to each node if a matching certificate is found in said path. In other words you can run it against your configuration data before piping it into your configuration ... this way you can literally push the proper settings and sign passwords with the appropriate cert.
So the function and DSC resource are pretty tightly coupled... but they really have very separate uses (only one is for the target nodes). In this scenario would you generally recommend two modules be made? Or error on the side of putting them as separate resources in the same module because they are so closely related?
February 10, 2016 at 3:10 pm #35146KeymasterTopics: 13Replies: 4872Points: 1,811Rank: Community Hero
If one is going to end up depending on the other, I'd just put them in one. But what it seems like you're saying is that you have (A) a resource, and (B) a non-resource module that contains a kind of helper function. If there's no dependency between them – e.g., they can run standalone – make 'em separate.
February 10, 2016 at 3:27 pm #35147ParticipantTopics: 29Replies: 125Points: 0Rank: Member
You are correct: technically you don't _need_ the helper function for the DSC resource. It's really just something I wrote so that other people who may want to use the resource don't have to figure out how to use this "folder of current certs" that ends up being created by it.
Sounds like separate is the appropriate answer. My hesitation was in pointing out to people that the two are related: If I publish two modules to PowerShell Gallery just make mention in the help file that there's another module with helper functions for the build process?
The topic ‘Single Module with both DSC resources and "traditional" resources?’ is closed to new replies.