Skip to content

Commit

Permalink
Add global tags and per-item tags (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
snovikov authored Jan 31, 2024
1 parent c7f4b07 commit 678fbe9
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ TF_MODULES = $(sort $(dir $(wildcard $(CURRENT_DIR)modules/*/)))
# -------------------------------------------------------------------------------------------------
# Container versions
# -------------------------------------------------------------------------------------------------
TF_VERSION = 1.3.9
TF_VERSION = 1.5.7
TFDOCS_VERSION = 0.16.0-0.34
FL_VERSION = latest-0.8
JL_VERSION = 1.6.0-0.14
Expand Down
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,6 @@ Type: `string`

The following input variables are optional (have default values):

### <a name="input_tags"></a> [tags](#input\_tags)

Description: Tags applied to the resources

Type: `list(string)`

Default: `[]`

### <a name="input_items"></a> [items](#input\_items)

Description: A list of dicts with secret information
Expand All @@ -68,11 +60,20 @@ list(object({
name = string
username = string
password = string
tags = optional(list(string), [])
}))
```

Default: `[]`

### <a name="input_tags_all"></a> [tags\_all](#input\_tags\_all)

Description: Tags applied to all the resources

Type: `list(string)`

Default: `[]`

<!-- TFDOCS_INPUTS_END -->

<!-- TFDOCS_OUTPUTS_START -->
Expand Down
2 changes: 1 addition & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ resource "onepassword_item" "items" {
username = each.value.username
password = each.value.password

tags = concat(var.tags, ["Managed by Terraform"])
tags = concat(var.tags_all, each.value.tags)
}
13 changes: 7 additions & 6 deletions variables.tf
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
variable "tags" {
description = "Tags applied to the resources"
type = list(string)
default = []
}

variable "vault_id" {
description = "id of the vault where the items are stored"
type = string
Expand All @@ -16,6 +10,13 @@ variable "items" {
name = string
username = string
password = string
tags = optional(list(string), [])
}))
default = []
}

variable "tags_all" {
description = "Tags applied to all the resources"
type = list(string)
default = []
}

0 comments on commit 678fbe9

Please sign in to comment.