Skip to content

Commit

Permalink
Add custom fields (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
snovikov authored Aug 28, 2024
1 parent 3d8f2bd commit bc80591
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 5 deletions.
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ For requirements regarding module structure: [style-guide-terraform.md](https://

| Name | Version |
|------|---------|
| <a name="provider_onepassword"></a> [onepassword](#provider\_onepassword) | >= 1.4.0 |
| <a name="provider_onepassword"></a> [onepassword](#provider\_onepassword) | >= 2.1.0 |

<!-- TFDOCS_PROVIDER_END -->

Expand All @@ -29,7 +29,7 @@ For requirements regarding module structure: [style-guide-terraform.md](https://
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.5 |
| <a name="requirement_onepassword"></a> [onepassword](#requirement\_onepassword) | >= 1.4.0 |
| <a name="requirement_onepassword"></a> [onepassword](#requirement\_onepassword) | >= 2.1.0 |

<!-- TFDOCS_REQUIREMENTS_END -->

Expand Down Expand Up @@ -59,9 +59,14 @@ list(object({
category = optional(string, "login")
name = string
username = string
password = string
password = optional(string)
url = optional(string)
tags = optional(list(string), [])
sections = optional(map(list(object({
label = string
type = optional(string)
value = optional(string)
}))), {})
}))
```

Expand Down
15 changes: 15 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,20 @@ resource "onepassword_item" "this" {
password = each.value.password
url = each.value.url

dynamic "section" {
for_each = each.value.sections
content {
label = section.key
dynamic "field" {
for_each = section.value
content {
label = field.value.label
type = field.value.type
value = field.value.value
}
}
}
}

tags = sort(concat(var.tags_all, each.value.tags))
}
7 changes: 6 additions & 1 deletion variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,14 @@ variable "items" {
category = optional(string, "login")
name = string
username = string
password = string
password = optional(string)
url = optional(string)
tags = optional(list(string), [])
sections = optional(map(list(object({
label = string
type = optional(string)
value = optional(string)
}))), {})
}))
default = []
}
Expand Down
2 changes: 1 addition & 1 deletion versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ terraform {
required_providers {
onepassword = {
source = "1Password/onepassword"
version = ">= 1.4.0"
version = ">= 2.1.0"
}
}
required_version = ">= 1.5"
Expand Down

0 comments on commit bc80591

Please sign in to comment.