-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possible bug or advice needed #376
Comments
Just making sure I understand the ask - you have yaml formated text in your AWS secret that you would like to retrieve and be able to manipulate with spruce. However when spruce retrieves it, it comes back as a multiline string, rather than a datastructure. Correct?You may be able to modify the awssecret operator to parse this out into a datastructure, but I'm not sure if it will get pulled in soon enough to be referenced by all the other operators since there are multiple phases of the merge process.You might be able to use some of the cherry pick flags to isolate the value being returned, save it to a file, and then run a second merge process though. if that doesn't work you could probably send the aws secret merge output to yq -r and then pull that info into a second merge. It's been a while but you may also be able to pull in datastructures from environment variables, so if you're concerned about writing secrets to disk temporarily, you could store them as an env var. there might be code related to parsing that out into datastructures you can reference for the aws operator. Sent from my iPhoneOn Apr 28, 2023, at 11:48 AM, Mihai Vultur ***@***.***> wrote:
Hello,
First of all thank you for this tool. I've integrated it in our workflow and I stumbled upon the following issue, possible yaml unmarshal bug.
Spruce version: v1.30.2
Description:
I would like to store a yaml file in AWS Secrets manager with plaintext option. Then use the awssecret DSL to fetch the content and be interpreted as yaml.
Steps to reproduce:
Store the following yaml content in aws secrets manager:
options:
labelsValidations:
Owner:
Manufacturer:
- value1
- value2
- value3
- value4
Then use the following file to retrieve it as a YAML structure:
cat qwe.yaml
---
fetched_from_secrets: (( awssecret "/sre/non-prod-config?key=options" ))
Expected outcome:
# spruce merge qwe.yaml
fetched_from_secrets:
labelsValidations:
Owner:
Manufacturer:
- value1
- value2
- value3
- value4
Actual outcome:
spruce merge qwe.yaml
fetched_from_secrets: map[labelsValidations:map[Manufacturer:[value1 value2 value3
value4] Owner:<nil>]]
I've tried various ways such as, not specifying the yaml key:
# cat qwe.yaml
---
fetched_from_secrets: (( awssecret "/sre/non-prod-config" ))
or
…---
fetched_from_secrets:
(( awssecret "/sre/non-prod-config" ))
# spruce merge qwe.yaml
fetched_from_secrets: |-
options:
labelsValidations:
Owner:
Manufacturer:
- value1
- value2
- value3
- value4
However, this way the value is presented as multiline string/block, and it can't be further parsed by subsequent (( join "/" fetched_from_secrets.labelsValidations.Manufacturer )) which we would like.
Any suggestion that would allow me to achieve the Expected outcome ?
Thank you in advance!
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Hi Geoff,
Yes, that is correct. Is that expected or a bug?
Actually, I was thinking to defer the processing of the rest of the operators until the next run and run spruce in multiple phases. Something like:
Thanks! |
Hello,
First of all thank you for this tool. I've integrated it in our workflow and I stumbled upon the following issue, possible yaml unmarshal bug.
Spruce version: v1.30.2
Description:
I would like to store a yaml file in AWS Secrets manager with plaintext option. Then use the
awssecret
DSL to fetch the content and be interpreted as yaml.Steps to reproduce:
Store the following yaml content in aws secrets manager:
Then use the following file to retrieve it as a YAML structure:
I've tried various ways such as, not specifying the yaml key:
However, this way the value is presented as multiline string/block, and it can't be further parsed by subsequent
(( join "/" fetched_from_secrets.labelsValidations.Manufacturer ))
which we would like.Any suggestion that would allow me to achieve the
Expected outcome
?Thank you in advance!
The text was updated successfully, but these errors were encountered: