Skip to content

Provider produced inconsistent result for string value in section #214

Open
@Nothing4You

Description

@Nothing4You

Your environment

Terraform Provider Version: 2.1.2

Connect Server Version: N/A

CLI Version: 2.30.3

OS: macOS

Terraform Version: OpenTofu v1.9.0

What happened?

Error: Provider produced inconsistent result after apply

Item will be created but marked as tainted, requiring recreation.

What did you expect to happen?

No error.

Steps to reproduce

terraform {
  required_providers {
    onepassword = {
      source  = "1Password/onepassword"
      version = "2.1.2"
    }
  }
}

provider "onepassword" {
  account = "valtech.1password.eu"
}

resource "onepassword_item" "item" {
  vault = "*stripped*"

  title    = "test"
  category = "password"

  password_recipe {
    length  = 32
    digits  = true
    letters = true
    symbols = true
  }

  section {
    label = "test"

    field {
      label = "test"
      type = "string"
      value = "test"
    }
  }
}

Notes & Logs

OpenTofu used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  + create

OpenTofu will perform the following actions:

  # onepassword_item.item will be created
  + resource "onepassword_item" "item" {
      + category = "password"
      + id       = (known after apply)
      + password = (sensitive value)
      + title    = "test"
      + uuid     = (known after apply)
      + vault    = "*stripped*"

      + password_recipe {
          + digits  = true
          + length  = 32
          + letters = true
          + symbols = true
        }

      + section {
          + id    = (known after apply)
          + label = "test"

          + field {
              + id    = (known after apply)
              + label = "test"
              + type  = "string"
              + value = (sensitive value)
            }
        }
    }

Plan: 1 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  OpenTofu will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

onepassword_item.item: Creating...
╷
│ Error: Provider produced inconsistent result after apply
│
│ When applying changes to onepassword_item.item, provider "provider[\"registry.opentofu.org/1password/onepassword\"]" produced an unexpected new value: .section[0].field[0].type: was cty.StringVal("string"), but now
│ cty.StringVal("STRING").
│
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
╵

Workaround as described in #194:

Change type from string to STRING.

Based on the documentation, this is supposed to receive uppercase values: https://registry.terraform.io/providers/1Password/onepassword/latest/docs/resources/item#type-2

This should either be changed to internally convert this to uppercase or reject lowercase values before trying to apply them.

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