terraform-provider-onepassword icon indicating copy to clipboard operation
terraform-provider-onepassword copied to clipboard

Feature Request: Add fields to each items default section

Open codezninja opened this issue 4 years ago • 2 comments

Summary

In 1password UI each item has a default section with certain keys for different template types. You also have the ability to add different fields to the default section. It doesn't seem possible to edit that default section with custom fields through terraform currently.

I can add custom sections with my custom fields but I would like to also add certain fields to the default section for each item as well.

Proposed solution

resource "onepassword_item" "item" {
  vault = var.vault

  title    = var.name
  category = var.category

  username = var.username
  password = var.password
  database = var.database
  port     = var.port

  password_recipe {
    length  = var.password_recipe.length
    letters = var.password_recipe.letters
    digits  = var.password_recipe.digits
    symbols = var.password_recipe.symbols
  }

  // This will be the custom field in the default section
  field {
    label = "some label"
    type = "STRING"
    value = "some value"
  }

  field {
    label = "some label2"
    type = "CONCEALED"
    value = "some value2"
  }

  // This will be the rest of the custom sections and fields in those sections for the object
  dynamic "section" {
    for_each = var.sections
    content {
      label = section.value.label
      dynamic "field" {
        for_each = section.value.fields
        content {
          label = field.value.label
          type = field.value.type
          value = field.value.value
        }
      }
    }
  }

Is there a workaround to accomplish this today?

Not that I can tell looking through the source code

codezninja avatar Apr 29 '21 18:04 codezninja