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

Add custom fields #6

Merged
merged 1 commit into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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