Skip to content

Conversation

@JillRegan
Copy link
Contributor

@JillRegan JillRegan commented Dec 4, 2025

✨ Summary

When a field is set to "" in Terraform, the provider was converting it to null when reading back from the sdk, causing Terraform to report an inconsistency.

To fix setStringValuePreservingEmpty preserves empty strings when they were explicitly set in the config, instead of converting them to null.

  • User-provided fields that can be set to "": title, url, username, hostname, database, port, note_value, section.label, field.label, field.value These need to distinguish between not set (null) and explicitly empty ("")

🔗 Resolves:

Resolves: #223
Resolves: #215
Resolves: #185

✅ Checklist

  • 🖊️ Commits are signed
  • 🧪 Tests added/updated: (See the Testing Guide for when to use each type and how to run them)
    • 🔹 Unit /🔸 Integration
    • 🌐 E2E
  • 📚 Docs updated (if behavior changed)

🕵️ Review Notes & ⚠️ Risks

For manual testing the item below covers the fields that many were running into when trying to set an empty string as a value. This should result in several inconsistent state warnings for the empty string field using most recent version of the provider. This fix in this issue allows us to pass these as empty strings.

resource "onepassword_item" "database" {
  vault    = data.onepassword_vault.test.uuid
  title    = "Database Test"
  category = "database"

  username   = ""
  database   = ""
  hostname   = ""
  port       = ""
  note_value = ""

  section {
    label = ""

    field {
      label = ""
      type  = "STRING"
      value = ""
    }
  }
}

@JillRegan JillRegan changed the title [DRAFT] Fix empty string handling Fix empty string handling Dec 5, 2025
@JillRegan JillRegan marked this pull request as ready for review December 5, 2025 19:43
@JillRegan JillRegan merged commit 078481d into main Dec 8, 2025
8 checks passed
@JillRegan JillRegan deleted the jill/fix-empty-string branch December 8, 2025 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants