Flat data structure
For a flat data structure, each input file will produce as many output files as the amount of elements in the data structure ( the flat data structure is looped over ). Each output file is rendered interpolating a single data element into the input file content.
Input file content
terraform {
required_providers {
{{name}} = {
source = "{{namespace}}/{{name}}"
version = "{{version}}"
}
}
}Data structure
[
{
"namespace": "hashicorp",
"name": "aws",
"version": "2.0.1"
},
{
"namespace": "hashicorp",
"name": "azure",
"version": "3.4.2"
},
{
"namespace": "hashicorp",
"name": "google",
"version": "1.2.1"
}
]Result
The following 3 files will generated from the single input file. One distinct file is generated for each element in the flat data structure.
terraform {
required_providers {
azure = {
source = 'az/azure'
version = '1.0.0'
}
}
}terraform {
required_providers {
aws = {
source = 'aws/aws'
version = '1.1.0'
}
}
}terraform {
required_providers {
gcp = {
source = 'gcp/gcp'
version = '1.2.0'
}
}
}Last updated
Was this helpful?