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

Section property not showing on version 2.x #183

Open
alekscp opened this issue Jun 21, 2024 · 2 comments
Open

Section property not showing on version 2.x #183

alekscp opened this issue Jun 21, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@alekscp
Copy link

alekscp commented Jun 21, 2024

Your environment

Terraform Provider Version: 2.1.0

Connect Server Version:

CLI Version: 2.29.0

OS: linux_amd64 (Terraform Cloud runner)

Terraform Version: 1.8.3

What happened?

The section field on a given item does not get pulled by the provider:

Logs using 2.1.0

...
Terraform will perform the following actions:

  # data.onepassword_item.cloudflare_zone_id will be read during apply
 <= data "onepassword_item" "cloudflare_zone_id" {
      + category   = (known after apply)
      + database   = (known after apply)
      + hostname   = (known after apply)
      + id         = (known after apply)
      + note_value = (sensitive value)
      + password   = (sensitive value)
      + port       = (known after apply)
      + tags       = (known after apply)
      + title      = "cloudflare_zone_id"
      + type       = (known after apply)
      + url        = (known after apply)
      + username   = (known after apply)
      + uuid       = (known after apply)
      + vault      = (known after apply)
    }
...

Logs using 1.4.3

...
Terraform will perform the following actions:

  # data.onepassword_item.cloudflare_zone_id will be read during apply
 <= data "onepassword_item" "cloudflare_zone_id" {
      + category   = (known after apply)
      + database   = (known after apply)
      + hostname   = (known after apply)
      + id         = (known after apply)
      + note_value = (sensitive value)
      + password   = (sensitive value)
      + port       = (known after apply)
      + section    = (known after apply)
      + tags       = (known after apply)
      + title      = "cloudflare_zone_id"
      + type       = (known after apply)
      + url        = (known after apply)
      + username   = (known after apply)
      + uuid       = (known after apply)
      + vault      = (known after apply)
    }
...
Changes to Outputs:
  ~ test = [
      - {
          - field = [
              - {
                  - id      = "hjbfafsv3cvq4m2kzqh3q3uq4q"
                  - label   = "text"
                  - purpose = ""
                  - type    = "STRING"
                  - value   = "some test"
                },
            ]
          - id    = "txgzmv35ep62s2jcz5gtbgcm6a"
          - label = "test"
        },

See the section property available when using version 1.4.3.

What did you expect to happen?

To have the section property available whilst using the latest version of the provider so that I can use its data.

Steps to reproduce

With a onepassword.tf file like so:

###
# NOTE: This is a workaround to have the `op` cli work in Terraform Cloud
# https://github.com/1Password/terraform-provider-onepassword/issues/141
###
resource "terraform_data" "install_op_cli" {
  input = timestamp()

  triggers_replace = [
    timestamp()
  ]

  provisioner "local-exec" {
    command = <<EOH
    ARCH="amd64"; \
    OP_VERSION="v$(curl https://app-updates.agilebits.com/check/1/0/CLI2/en/2.0.0/N -s | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+')"; \
    curl -sSfo op.zip \
    https://cache.agilebits.com/dist/1P/op2/pkg/"$OP_VERSION"/op_linux_"$ARCH"_"$OP_VERSION".zip \
    && mkdir tools \
    && unzip -od tools op.zip \
    && rm op.zip \
    && chmod 0755 tools/op \
    && export PATH="$PATH:$(pwd)/tools" \
    && echo $PATH \
    && op --version
EOH
  }
}

data "onepassword_vault" "infra_global" {
  name = "${var.tags.purpose}-infra-global"

  depends_on = [
    terraform_data.install_op_cli
  ]
}

data "onepassword_item" "cloudflare_zone_id" {
  vault = data.onepassword_vault.infra_global.uuid
  title = "cloudflare_zone_id"

  depends_on = [
    terraform_data.install_op_cli
  ]
}

output "test" {
  value = data.onepassword_item.cloudflare_zone_id.section
}

Notes & Logs

I have mainly tried to fetch the sections from Password and Server items until I realized that the version of the provider I was using was simply not providing me with those fields.

I've tried to aim for something similar to this

@alekscp alekscp added the bug Something isn't working label Jun 21, 2024
@david-pusch-protofy
Copy link

I bet that this is the same root cause as #187

@yNosGR
Copy link

yNosGR commented Dec 9, 2024

Is there any timeline for squashing this bug?

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

3 participants