Skip to content
Brandon Olin edited this page Jan 4, 2016 · 11 revisions

The POSHOrigin configuration file is where you define your resources to be evaluated by POSHOrigin. These configuration files will be read and translated into DSC configurations that get applied either to your local machine, or to a provisioning machine in order to provision infrastructure.

You define your resources in the configuration file by adding a resource block for each resource you want to provision.

my_folder.ps1
resource 'POSHOrigin:POSHFolder' 'folder01' @{
    description = 'this is an example folder'
    ensure = 'present'
    path = 'c:\'
}

Defining multiple resources in the same file is supported as well.

create_folders.ps1
resource 'POSHOrigin:POSHFolder' 'folder01' @{
    description = 'this is an example folder'
    ensure = 'present'
    path = 'c:\'
}

resource 'POSHOrigin:POSHFolder' 'folder02' @{
    description = 'this is another example folder'
    ensure = 'present'
    path = 'c:\'
}

The resource function is really an alias for the function New-POSHOriginResource that has three required parameters:

resource 'POSHOrigin:POSHFolder' 'folder01' @{...}
Function Type of resource to create Name of resource Hashtable of options for resource

The resource function will evaluate the parameters given to it, merge default options if specified, resolve any secrets listed into PowerShell credentials, and return one or more PowerShell custom objects. When you run Get-POSHOriginConfig (or gpoc) against a configuration file or folder, the resultant collection of PowerShell custom objects will be returned back to you. This array of objects can then be converted into a DSC configuration by passing them to Invoke-POSHOrigin or (ipo)

$myConfigs = Get-POSHOriginConfig -Path .\myFolder.ps1 -Verbose
$myConfigs | Invoke-POSHOrigin -Verbose

Clone this wiki locally