This repository was archived by the owner on Oct 21, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 9
This repository was archived by the owner on Oct 21, 2023. It is now read-only.
Add-ConIf cannot be used as a value for a parameter #82
Copy link
Copy link
Closed
Labels
Description
Description
JSON and YAML templates imply that is should be possible to use an If condition as the value for a parameter. However, this fails parameter validation.
Steps to reproduce
$Template = Initialize-VaporShell
$params = @{
LogicalID = 'AWSConfigRecorder'
Name = 'config-recorder'
RoleARN = Add-FnGetAtt -LogicalNameOfResource IamRoleAWSConfig -AttributeName Arn
RecordingGroup = Add-VSConfigConfigurationRecorderRecordingGroup -AllSupported $true -IncludeGlobalResourceTypes (
Add-ConIf -ConditionName IsActiveRegion -ValueIfTrue 'true' -ValueIfFalse 'false'
)
}
$Template.AddResource((
New-VSConfigConfigurationRecorder @params
))Expected result
Should allow a template to be generated containing the following content:
"ConfigRecorder": {
"Type": "AWS::Config::ConfigurationRecorder",
"Properties": {
"RoleARN": {
"Fn::GetAtt": [
"IamRoleAWSConfig ",
"Arn"
]
},
"RecordingGroup": {
"AllSupported": true,
"IncludeGlobalResourceTypes": {
"Fn::If": [
"IncludeGlobalResourceTypes",
true,
false
]
}
}
}
}Actual result
An error is raised:
Add-VSConfigConfigurationRecorderRecordingGroup:
Line |
5 | … dingGroup = Add-VSConfigConfigurationRecorderRecordingGroup -AllSuppo …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| This parameter only accepts the following types: System.Boolean, Vaporshell.Function. The current types of the value are: Vaporshell.Condition.If, Vaporshell.Condition, System.Management.Automation.PSCustomObject, System.Object.
Related to #81 for handling of bool values in ValueIfTrue and ValueIfFalse.