Skip to content

Intermittent Error: "Unable to read vault, got error: op error: cannot read config" #206

Open
@JM89

Description

@JM89

Your environment

Terraform Provider Version: 2.1.2

Connect Server Version:-

CLI Version: 2.30.0

OS: linux

Terraform Version: 1.9.8

What happened?

I receive an intermittent error when running terraform plan:

Unable to read vault, got error: op error: cannot read config at
"/home/appuser/.config/op/config": invalid JSON: unexpected end of JSON input

I provided a sample code below, we have about 30 items against the same 1Password vault, and we receive this error 1 out of 3 terraform plans. We noticed this issue on a smaller number of items too, but the frequency of occurrence increased with the number of items. When it fails, not all the items fail, only a few.

What did you expect to happen?

  • No error at all or at least a clear message so we can troubleshoot.

Steps to reproduce

  1. Terraform code:
// provider.tf
terraform {
  required_providers {
    onepassword = {
      source = "1Password/onepassword"
      version = "2.1.2"
    }
  }
}

provider "onepassword" {
  service_account_token = ""
}

// main.tf *30
data "onepassword_vault" "vault" {
  count = 1
  name  = var.onepassword_vault_name
}

resource "onepassword_item" "user_account" {
  count    = 1
  vault    = data.onepassword_vault.vault[0].uuid
  category = "login" 
  username = "username"
  password = sensitive(random_password.user_password.result)
  title    = "Title"
  url      = "https://validurl"
  tags     = ["Tag"]
}

resource "random_password" "user_password" {
  length           = 40
  special          = false
  lifecycle {
    ignore_changes = [length, override_special]
  }
}

Notes & Logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions