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
Former Member
2 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
2 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 '"')'"}'
```