Answers: <p>The split function returns a list of strings. I believe encapsulating the function in a list is what is giving you the error. Have you tried removing the brackets around the split function? Something like:</p>
  
  <pre><code>!Select [ "0",  !Split [ "," , !ImportValue [ !Sub "${ExportPrefix}-SubNets" ] ] ]
  </code></pre>
  
Answers: CC BY-SA 4.0
Answers: 2019-10-24T12:19:17.047Z
Answers: Trying that doesn't seem to work, it gives the below error message. I also tried by switching to long form `Fn::` compared to `!` that passed validation but it didn't deploy. Ran into where it just said it couldn't find the subnet with the full string/line
  
  Error message when using your suggesting without modification: `Template error: the attribute in Fn::ImportValue must be a string or a function that returns a string`
Answers: joshk132
Answers: CC BY-SA 4.0
Answers: 2019-10-23T20:29:26.820Z
Answers: 2019-10-23T20:29:26.820Z
Answers: Preston Martin
Body: <p>I have a cloud formation template that I want to import some values from another template. Currently the other template exports a string by joining together an array (better way of doing this?). </p>
  
  <p>In my template I want to import into I am getting the below error when trying to update my stack in the AWS console.</p>
  
  <p><code>Template format error: YAML not well-formed. (line 71, column 28)</code></p>
  
  <p>Here is lines 70 and 71 from my YAML file</p>
  
  <pre><code>SubnetId: 
          Fn::Select [ "0", [ Fn::Split: [ ",", Fn::ImportValue [ !Sub "${ExportPrefix}-SubNets"] ] ] ]
  </code></pre>
  
  <p>Have also tried this..</p>
  
  <pre><code>Fn::Select [ "0", [ {Fn::Split: [ ",", Fn::ImportValue [ {Fn::Sub "${ExportPrefix}-SubNets"}] ]} ] ]
  </code></pre>
  
  <p>I have checked and all spaces should be spaces and all tabs be tabs. </p>
  
Tags: <amazon-web-services><aws-cloudformation>
Title: Cloudformation YAML not well-formed
UserDisplayName: joshk132
ThreadText: # Cloudformation YAML not well-formed
  
  (Asked by: username_0 on 2019-10-23)
  
  I have a cloud formation template that I want to import some values from another template. Currently the other template exports a string by joining together an array (better way of doing this?).
  
  In my template I want to import into I am getting the below error when trying to update my stack in the AWS console.
  
  `Template format error: YAML not well-formed. (line 71, column 28)`
  
  Here is lines 70 and 71 from my YAML file
  
  ```
  SubnetId: 
          Fn::Select [ "0", [ Fn::Split: [ ",", Fn::ImportValue [ !Sub "${ExportPrefix}-SubNets"] ] ] ]
  
  ```
  
  Have also tried this..
  
  ```
  Fn::Select [ "0", [ {Fn::Split: [ ",", Fn::ImportValue [ {Fn::Sub "${ExportPrefix}-SubNets"}] ]} ] ]
  
  ```
  
  I have checked and all spaces should be spaces and all tabs be tabs.
  
  **Tags:** amazon-web-services, aws-cloudformation
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-10-23. Score: 1
  
  The split function returns a list of strings. I believe encapsulating the function in a list is what is giving you the error. Have you tried removing the brackets around the split function? Something like:
  
  ```
  !Select [ "0",  !Split [ "," , !ImportValue [ !Sub "${ExportPrefix}-SubNets" ] ] ]
  
  ```
  
  > **Comments:**
  > **username_0**: Trying that doesn't seem to work, it gives the below error message. I also tried by switching to long form `Fn::` compared to `!` that passed validation but it didn't deploy. Ran into where it just said it couldn't find the subnet with the full string/line  Error message when using your suggesting without modification: `Template error: the attribute in Fn::ImportValue must be a string or a function that returns a string`  
  
  ---
  
  