Skip to content

gomplate throw error "map has no entry for key \"spectra\" #1185

Answered by hairyhenderson
rameshkjha asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @rameshkjha, thanks for filing this - I've converted it to a discussion since this isn't a bug report or feature request.

The --datasource flag defines a datasource that can be accessed with the datasource/ds function. You're using it to define a datasource named config. So in this case you could access it with something like this:

namespace: "{{ (ds "config").spectra.instance.name }}"

You can also use the context as an alternative which makes for nicer (IMO) syntax, but there are tradeoffs. For your usage I'd recommend it. To use that you need the --context/-c flag:

$ gomplate ... --context config=./base/config.yaml
...

Then, you can access the context and the datasources attached to…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@rameshkjha
Comment options

@hairyhenderson
Comment options

Answer selected by rameshkjha
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1183 on July 24, 2021 13:36.