I’ve been using DSC (with custom modules and composite resources) to manage a number of servers. Now the time has come to make a change to one of my Composite Resources (CR), which is utilized by a few different configurations. I didn’t plan well for this, and I realized I’d like version control over my CR’s. In the future when I change a CR I’d like to create a new version, then change my existing configs to point to the new version as I see fit, or create new configs based on the new version of the CR.
So far so good. Right now I have a single module with all my CR’s in it (this is what all the tutorials online seem to show). Drill down inside the module folder, inside a CR folder, and you get to the x.psd1 and x.schema.psm1 files for a given CR. The x.psd1 file contains a line that says “ModuleVersion = ‘x.x.x’”. This makes me think I could specify this CR’s version when referencing it in a config. However, I don’t see any way to do that. The only thing I see for specifying a version is the “ModuleVersion” paramater for “Import-DscResource”. But it’s not the version of the module I want to specify, it’s the version of the composite resource inside the module!
So, maybe I have to split out all my CR’s into separate modules, and version the modules. But if that’s necessary, what’s the point of the .psd1 file for the CR with the version number in it?
By the way, I’d love to hear others’ approaches to versioning things in DSC. I don’t see it addressed much in the literature, but it has got to be a common desire to make a change to a bunch of servers (either the way you configure them or a fix/enhancement to a custom resource) but roll it out in a slow and controlled fashion.