Ore*_*man 5 powershell list aws-cloudformation aws-ssm
我使用 CloudFormation 创建了一个 AWS SSM 文档:
SSMDocument::
Type: AWS::SSM::Document
Properties:
DocumentType: Command
Content:
schemaVersion: '2.2'
description: Run a PowerShell script
parameters:
Node1:
type: String
Node2:
type: String
List:
type: StringList
mainSteps:
- action: aws:runPowerShellScript
name: PreDeploy
precondition:
StringEquals:
- platformType
- Windows
inputs:
timeoutSeconds: '3600'
runCommand:
- |
# Retrieve values from parameters
$IpNode1 = "{{Node1}}"
$IpNode2 = "{{Node2}}"
$List = "{{EnvNames}}"
Run Code Online (Sandbox Code Playgroud)
该文档包含PowerShell在新创建的实例上执行的脚本。我正在传递参数,其中之一($List)具有 type StringList,问题是我收到错误:
Parameter "List" is "STRING_LIST" type and can't be used as a substring parameter.
Run Code Online (Sandbox Code Playgroud)
我尝试过但没有运气:
$List = "{{EnvNames}}"
$List = ["{{EnvNames}}"]
$List = @("{{EnvNames}}")
Run Code Online (Sandbox Code Playgroud)