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

Feature request: Set default tags for the provider #89

Open
jsvensson opened this issue Jun 29, 2023 · 1 comment
Open

Feature request: Set default tags for the provider #89

jsvensson opened this issue Jun 29, 2023 · 1 comment

Comments

@jsvensson
Copy link

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:

  • Set a tag like "terraform-managed" to see that Terraform manages the 1Password object
  • Set a tag to identify which service/repository etc the resource belongs to/is used by

Proposed solution

  • Define optional default tags in the provider settings
  • Default tags are merged together with any tags defined in the resource

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
Copy link

remyje commented Apr 28, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants