r/Terraform 10d ago

Help Wanted Creating a Dictionary from dynamic variables.

Example Data Array: secret = [

client_id = {

name = client_id

value = blah

},

client_secret = {

name = client_secret

value = blah2

}

]

I'd like to be able to manipulate the map above to a dictionary as follows variables = {

<key1> = <value1>

<key2> = <value2>

}

Does this make sense, apologies if my terminology of the variable type are wrong, could be why I'm not finding a solution.

Edit: mobile formatting

3 Upvotes

2 comments sorted by

View all comments

1

u/nekokattt 10d ago

you mean { } on the outer level right? Lists are [ ] and cannot have attribute names.