I am currently writing a TF module for Vault that manages our namespaces, and am having a bit of trouble trying to extract a YAML dictionary into values.
All of the data will exist in a YAML file, with each namespace providing the following values, which will be used to provision OIDC roles, policy etc.
namespaces:
"project-bob":
owner: bob
ad-group:
roles:
- "A"
- "B"
horses:
- "C"
dogs:
- "D"
cats:
- "E"
- "F"
- "G"
employee: "full-time"
supporthrs: 247hrs
edit: true
I can extract the data in terraform console as a complete dump of the data, using yamldecode as well as using hardcoded values for a given namespace to extract elements.
With the key being in this case project-bob and the values being all of the project-bob data.
What I am having trouble with, is extracting the key as a variable, when we won’t know the value of the individual keys.
All of the examples I have found have known key values, which make it easy to then get the values.
I will be open to changing the format of the schema if it would be better, but I need to keep the elements.