Retrieve values from parameters [StringList] in AWS::SSM::Document

Viewed 675

I've created an AWS SSM Document using CloudFormation:

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}}"

This document contains a PowerShell script that is executing on newly created instances. I'm passing parameters and one of them ($List) has type StringList, the issue is that I'm getting an error:

Parameter "List" is "STRING_LIST" type and can't be used as a substring parameter.

I've tried without luck:

$List = "{{EnvNames}}"
$List = ["{{EnvNames}}"]
$List = @("{{EnvNames}}")
0 Answers
Related