It’s Cybersecurity Awareness Month! Join our interactive training session, or learn about security and AI from 1Password experts.
Forum Discussion
Former Member
3 years agoHow to get TOTP token from API connect server using Terraform?
Hi,
I've set up the API connect server and I'm trying to get a TOTP token from an item.
I can successfully retrieve it while using the API with curl but not via Terraform provider.
It's sup...
Former Member
3 years agoI have found a workaround for achieve this, on Terraform manifest I have added:
data "external" "test_token_otp" {
program = [ "${path.module}/setup.sh" ]
}
and this what setup.sh
script does:
```
!/usr/bin/env bash
set -e
echo '{"otp": "'$(curl -s $OP_ENDPOINT/v1/vaults/66qfxcm..../items/h7fhsftv.... -H "Authorization: Bearer $OP_TOKEN" | jq '.fields[]| select(.label=="token") | .totp' | tr -d '"')'"}'
```