1Password / terraform-provider-onepassword

Use the 1Password Terraform Provider to reference, create, or update items in your 1Password Vaults.
https://developer.1password.com/docs/terraform/
MIT License
323 stars 48 forks source link

Feature request: Set default tags for the provider #89

Open jsvensson opened 1 year ago

jsvensson commented 1 year ago

Summary

Add provider settings to define one or more tags that get added by default to resources.

Use cases

Default tags would provide several useful use cases:

Proposed solution

Example format:

provider "onepassword" {
  default_tags {
    tags = ["foo", "bar"]
  }

Given a resource like this, the finalized set of tags for the resource would be ["foo", "bar", "baz"].

resource "onepassword_item" "example" {
  tags = ["baz"]
}

Is there a workaround to accomplish this today?

None I'm aware of.

References & Prior Work

remyje commented 6 months ago

Generally the workaround for this is something like

locals {
  op_default_tags = ["foo", "bar"]
}

resource "onepassword_item" "example" {
  tags = concat(local.op_default_tags, ["baz"])
}

So if you are managing multiple items, you need only define the tags in one place.