Flatten
Sometimes we have to work with very complex data structures, but module only requires a simple list of objects or a map. Falltern functions helps us with converting complex data structures into lists.
Let's start by creating a a file with the name ssm-parameters\variables.tf
,
In here, I define a variable with name 'parameter', and I also provide the data types of the object. Set it's default value to an empty list.
Next let's create a file with the name ssm-parameters\ssm-parameter.tf
,
In here, the local defines how the flatten should be used on the passed parameters.
Next let's create a file with the name provider.tf
,
Finally a file with the name parameters.tf
,
In here the complex data structure is defined as a local variable and this will be transformed by the flatten function defined in the local of the module.
Last updated
Was this helpful?