Problem:
Semi-hard coded variables being used within the resource code are difficult to identify and add to development/support burden. This example prevents us from moving to things like encrypted secrets file easily and results in too much development overhead.
$d = Get-Content $(Join-Path ([Environment]::GetEnvironmentVariable('defaultPath','Machine')) 'secrets.json') -Raw | ConvertFrom-Json
.....
... $('CN=', $d.PullServerAddress -join ''), -ss ...
Proposed solution:
Convert all such variables into parameters that can be passed to the resource as part of the DSC configuration that is calling it. If we want to offer sensible defaults then these can be assigned within the parameter block.
Problem code:
https://github.com/rsWinAutomationSupport/rsDSCCert/blob/universal/DSCResources/RS_rsPullCert/RS_rsPullCert.psm1#L28
Problem:
Semi-hard coded variables being used within the resource code are difficult to identify and add to development/support burden. This example prevents us from moving to things like encrypted secrets file easily and results in too much development overhead.
Proposed solution:
Convert all such variables into parameters that can be passed to the resource as part of the DSC configuration that is calling it. If we want to offer sensible defaults then these can be assigned within the parameter block.
Problem code:
https://github.com/rsWinAutomationSupport/rsDSCCert/blob/universal/DSCResources/RS_rsPullCert/RS_rsPullCert.psm1#L28