How to loop list in a Yaml data source #1845
-
I have a need to generate multiple output files based on a single template. The key is a list defined in a yaml datasource
I have the file put working using the temp.Exec and file.Write functions (using a simple math.Seq), however i am currently unable to loop based on the regions from the datasource.
No matter what i try i get a template rendering error |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hi @ffsetit, that error is a YAML parsing error. YAML like this is invalid: primary: us-east1
abbr: use1 The problem is that it's interpreting You'll need to fix the YAML first. I would suggest something like: primary:
name: us-east1
abbr: use1 |
Beta Was this translation helpful? Give feedback.
Hi @ffsetit, that error is a YAML parsing error. YAML like this is invalid:
The problem is that it's interpreting
us-east1
as a scalar (string) value for the keyprimary
, but it seems you're also trying to assign an object value (abbr: use1
).You'll need to fix the YAML first. I would suggest something like: