Test only DSC resources

Welcome Forums DSC (Desired State Configuration) Test only DSC resources

This topic contains 2 replies, has 2 voices, and was last updated by

 
Participant
8 months ago.

  • Author
    Posts
  • #96143

    Participant
    Points: 0
    Rank: Member

    Hi all,

    For some use cases, our DSC deployments depend on non-DSC resources (an open TCP port on a remote machine, a version of a remote service etc.).

    I wonder if writing a DSC custom resource that just has payload in the Get and Test functions (and an empty Set function) is a good idea or an heresy ? The DSC configuration would fail fast and not deploy anything if prerequisites are not compliants.

    Are you aware of such resources in the wild ?

  • #96176

    Participant
    Points: 0
    Rank: Member

    Here's a good working example. The Test just returns an immediate true/false regarding the state of the remote thing (in this case AD) and Set manages how long to wait for it to be in the required state and logging. That way you can run test-dscconfiguration without waiting on a timer.

    https://github.com/PowerShell/xActiveDirectory/blob/dev/DSCResources/MSFT_xWaitForADDomain/MSFT_xWaitForADDomain.psm1#L78

  • #96177

    Participant
    Points: 0
    Rank: Member

    Nice example, thank you !

The topic ‘Test only DSC resources’ is closed to new replies.