Skip to content

Commit

Permalink
Merge pull request #1 from Flaconi/plt-761
Browse files Browse the repository at this point in the history
PLT-761 - Create one password module to store items
  • Loading branch information
Engerim authored Jan 11, 2024
2 parents 91dfe11 + 5cd4ef3 commit c7f4b07
Show file tree
Hide file tree
Showing 7 changed files with 90 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @Flaconi/devops
* @Flaconi/devops @Flaconi/platform
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ jobs:
git diff --quiet || { echo "Build Changes"; git diff; git status; false; }
env:
TARGET: ${{ matrix.target }}
RETRIES: 20
RETRIES: 1
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ jobs:
}
retry make test
env:
RETRIES: 20
RETRIES: 1
59 changes: 46 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# terraform-module-template
Template for Terraform modules

<!-- Uncomment and replace with your module name
[![lint](https://github.com/flaconi/<MODULENAME>/workflows/lint/badge.svg)](https://github.com/flaconi/<MODULENAME>/actions?query=workflow%3Alint)
[![test](https://github.com/flaconi/<MODULENAME>/workflows/test/badge.svg)](https://github.com/flaconi/<MODULENAME>/actions?query=workflow%3Atest)
[![Tag](https://img.shields.io/github/tag/flaconi/<MODULENAME>.svg)](https://github.com/flaconi/<MODULENAME>/releases)
-->
# terraform-onepassword-item-store

Module to store secrets in one password vaults

[![lint](https://github.com/flaconi/terraform-onepassword-item-store/workflows/lint/badge.svg)](https://github.com/flaconi/terraform-onepassword-item-store/actions?query=workflow%3Alint)
[![test](https://github.com/flaconi/terraform-onepassword-item-store/workflows/test/badge.svg)](https://github.com/flaconi/terraform-onepassword-item-store/actions?query=workflow%3Atest)
[![Tag](https://img.shields.io/github/tag/flaconi/terraform-onepassword-item-store.svg)](https://github.com/flaconi/terraform-onepassword-item-store/releases)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT)

For requirements regarding module structure: [style-guide-terraform.md](https://github.com/Flaconi/devops-docs/blob/master/doc/conventions/style-guide-terraform.md)
Expand All @@ -18,7 +17,9 @@ For requirements regarding module structure: [style-guide-terraform.md](https://
<!-- TFDOCS_PROVIDER_START -->
## Providers

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

<!-- TFDOCS_PROVIDER_END -->

Expand All @@ -27,18 +28,50 @@ No providers.

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | ~> 1.3 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.5 |
| <a name="requirement_onepassword"></a> [onepassword](#requirement\_onepassword) | >= 1.4.0 |

<!-- TFDOCS_REQUIREMENTS_END -->

<!-- TFDOCS_INPUTS_START -->
## Required Inputs

No required inputs.
The following input variables are required:

### <a name="input_vault_id"></a> [vault\_id](#input\_vault\_id)

Description: id of the vault where the items are stored

Type: `string`

## Optional Inputs

No optional inputs.
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

Type:

```hcl
list(object({
category = optional(string, "login")
name = string
username = string
password = string
}))
```

Default: `[]`

<!-- TFDOCS_INPUTS_END -->

Expand All @@ -53,4 +86,4 @@ No outputs.

**[MIT License](LICENSE)**

Copyright (c) 2023 **[Flaconi GmbH](https://github.com/flaconi)**
Copyright (c) 2024 **[Flaconi GmbH](https://github.com/flaconi)**
13 changes: 13 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
resource "onepassword_item" "items" {
for_each = { for parameter in var.items : parameter.name => parameter }
vault = var.vault_id

category = each.value.category

title = each.value.name

username = each.value.username
password = each.value.password

tags = concat(var.tags, ["Managed by Terraform"])
}
21 changes: 21 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
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
}

variable "items" {
description = "A list of dicts with secret information"
type = list(object({
category = optional(string, "login")
name = string
username = string
password = string
}))
default = []
}
8 changes: 7 additions & 1 deletion versions.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
terraform {
required_version = "~> 1.3"
required_providers {
onepassword = {
source = "1Password/onepassword"
version = ">= 1.4.0"
}
}
required_version = ">= 1.5"
}

0 comments on commit c7f4b07

Please sign in to comment.