Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create JSON/YAML for configs that only use /*powershell adapter, from PowerShell script #396

Open
mgreenegit opened this issue Apr 10, 2024 · 1 comment
Labels
Issue-Enhancement The issue is a feature or idea

Comments

@mgreenegit
Copy link
Member

mgreenegit commented Apr 10, 2024

Summary of the new feature / enhancement

To help preserve compatibility with existing configurations, it would help if a configuration .ps1 script could create JSON/YAML config and setup the PowerShell or WindowsPowerShell adapter. This will require a lot of feedback to get right, so creating this issue as a placeholder.

@mgreenegit mgreenegit added the Issue-Enhancement The issue is a feature or idea label Apr 10, 2024
@michaeltlombardi
Copy link
Collaborator

@mgreenegit can you elaborate on this a bit more? Is this something like:

./new-dscv3config.ps1 -Name MyConfig
Get-Content -Path ./MyConfig.dsc.config.yaml
$schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/config/document.json
resources:
- name: PowerShell DSC resources
  type: Microsoft.DSC/PowerShell
  properties:
    resources:
    - name: <INSTANCE_NAME>
      type: <PSDSC_MODULE_NAME>/<PSDSC_RESOURCE_NAME>
      properties:
        PropertyName: PropertyValue

Or is it meant to investigate the contents of a DSCv1.1/v2 configuration-creating script and emit the equivalent YAML?

For example, converting this:

Configuration MyDscConfiguration {
    Environment FirstEnvironmentVariable {
        Ensure = 'Present'
        Name   = 'Foo'
        Value  = 'Example'
    }

    Environment SecondEnvironmentVariable {
        Ensure = 'Present'
        Name   = 'Bar'
        Value  = 'Another'
    }
}

into this:

$schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/config/document.json
resources:
- name: MyDscConfiguration
  type: Microsoft.DSC/PowerShell
  properties:
    resources:
    - name: FirstEnvironmentVariable
      type: PSDscResources/Environment
      properties:
        Name: Foo
        Ensure: Present
        Value: Example
    - name: SecondEnvironmentVariable
      type: PSDscResources/Environment
      properties:
        Name: Bar
        Ensure: Present
        Value: Another

Or something else?

I'm also not sure what you mean by "setup the PowerShell or WindowsPowerShell adapter" in this case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Enhancement The issue is a feature or idea
Projects
None yet
Development

No branches or pull requests

2 participants