Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
JM89 opened this issue Dec 5, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@JM89
Copy link

JM89 commented Dec 5, 2024

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

@JM89 JM89 added the bug Something isn't working label Dec 5, 2024
@jb1p
Copy link

jb1p commented Dec 23, 2024

Hi @JM89 thank you for the report. We are currently investing in switching this provider from using the CLI to using our 1Password Go SDK directly. Some more context can be found here.

Can you try running terraform apply command with -parallelism=1 and see if this issue persists?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants