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

skobow's avatar
skobow
New Contributor
8 months ago

Retrieve SSH private key with Terraform Provider

Hi!
I am currently trying to use an "onepassword_item" to retrieve a SSH private key in a terraform script. I am using the CLI in the provider config. Getting the complete item with the cli works and I can see the private key. However it does not seem to be contained in the data item.

Provider config:

provider "onepassword" {
account = var.op_account_id
}

Getting the data with

data "onepassword_item" "ssh_key" {
vault = "<value_id>"
uuid = "<item_id>"
}

and then using it in a resource with

...
"sshPrivateKey" = "${data.onepassword_item.repository_deploy_key.private_key}"
...

I also checked the tf state and it also does not contain the private key:

```
tf state show module.test.data.onepassword_item.ssh_key

data "onepassword_item" "ssh_key" {
category = "ssh_key"
id = ""
note_value = (sensitive value)
public_key = ""
title = "My SSH Key"
uuid = ""
vault = ""
}
```

Am I doing something wrong?


1Password Version: Not Provided
Extension Version: Not Provided
OS Version: Not Provided
Browser: Not Provided

No RepliesBe the first to reply