Retrieve SSH private key with Terraform Provider

skobow
skobow
Community Member

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         = "<id>"
    note_value = (sensitive value)
    public_key = "<public_key_data>"
    title      = "My SSH Key"
    uuid       = "<uuid>"
    vault      = "<vault_id>"
}

Am I doing something wrong?


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