Last active
June 4, 2023 13:20
-
-
Save denelon/b1ebafcb39331cec7dcdcea1a35ef162 to your computer and use it in GitHub Desktop.
Checks for presence of environment variable and removes it
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# yaml-language-server: $schema=https://aka.ms/configuration-dsc-schema/0.1 | |
# Requires administrator | |
# Checks for presence of environment variable and removes it if it's present. | |
properties: | |
configurationVersion: '0.1.0' | |
assertions: | |
- resource: Environment | |
directives: | |
module: PSDscResources | |
settings: | |
Name: 'DSC_EXAMPLE' | |
Ensure: 'Present' | |
Value: 'Desired State Configuration' | |
Target: 'Machine' | |
resources: | |
- resource: Environment | |
directives: | |
module: PSDscResources | |
settings: | |
Name: 'DSC_EXAMPLE' | |
Ensure: 'Absent' | |
Value: 'Desired State Configuration' | |
Target: 'Machine' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Isn't it redundant to check (
assert
) if the env var exists before removing it? That'simperative
, notdeclarative
. In adeclarative
model describing a resource asabsent
should be all that's required.