Getting started with 1Password for your growing team, or refining your setup? Our Secured Success quickstart guide is for you.
Forum Discussion
mike99
2 years agoOccasional Contributor
"Correct" way to read custom fields in ```onepassword_item``` data source
Hi,
We're looking at migrating from HashiCorp Vault to 1Password as a secret provider for our terraform projects.
At present we have something like this:
```
provider "vault" {
address...
jerdew
2 years agoNew Contributor
I thought the same at first, but the issue comment helped me understand how a 'module' was gonna help me out. The key part is here:
```
module "test_item" {
source = "./op_password"
vault_uuid = data.onepassword_vault.vault.uuid
title = "Test"
}
this is how my updated code now looks
data "onepassword_item" "password" {
vault = data.onepassword_vault.vault.uuid
title = var.title
}
locals {
op_fields = { for f in data.onepassword_item.password.section[0].field : f.label => {
id = f.id
purpose = f.purpose
type = f.type
value = f.value
}
}
...
```
The 'title' is the name of the 1password item, so you can add module "my_spn" { ...
and module "my_other_spn" {
, then access them as module.my_spn.op_fields["etc"]