Signing back into the Community for the first time? You'll need to reset your password to access your account. Find out more.
Forum Discussion
wagnerone
3 months agoContributor
What 1Password field type to store a json formatted secret?
I have a lengthy json formatted secret I want to store in 1Password and access for use in terraform (using the provider or otherwise), but I can't figure out how to store a json file in 1Password without it stripping the whitespace/formatting.
I tried adding it to a Password and that doesn't allow multi-line. It looks like Text would do it, but I'd prefer it not be immediately visible in the 1Password client.
I tried a txt file attachment to a record, but there is not "copy secret reference" for that field type (though maybe it is still accessible in that way?).
Thanks,
Mike
1Password Version: Not Provided
Extension Version: Not Provided
OS Version: Not Provided
Browser: Not Provided
- wagneroneContributor
Thanks for your reply, csharpsteen - I didn't get notified or missed the notification when you posted.
I think my "best" course, based on your feedback, for this particular secret is to past it into a unobscured Text field. The json is pretty fluid and at present regular changes are being made.
Might have to investigate something like Hashicorp vault for this. Was hoping to leverage our investment in 1Password.
- csharpsteenNew Contributor
For this situation, I typically remove the line breaks so that it can be stored in a field of type Password.
jq -c
can do the needed removals.Makes the secret cumbersome for a human to work with, but it works.
Otherwise, pasting the pretty-printed value into a field of type Text works but the value is not obscured in the client.
Another option is to create a template. Usually, only one or two values in a large JSON document are the actual sensitive secrets. Replace those with references to simpler Password or Login vault items and use
op inject
to render a file with the secret values filled in.Terraform may also have native templating features that can generate the JSON without the need for a file to live on disk.