From d13ded80f6eb74baff9e1ea39b82a93e314e3dba Mon Sep 17 00:00:00 2001 From: Frederic Leger Date: Fri, 12 May 2023 20:41:38 +0200 Subject: [PATCH] feat: add password store put --- password-store/put/.terraform.lock.hcl | 10 ++++++ password-store/put/.tflint.hcl | 0 password-store/put/README.md | 43 ++++++++++++++++++++++++++ password-store/put/main.tf | 0 password-store/put/outputs.tf | 9 ++++++ password-store/put/providers.tf | 9 ++++++ password-store/put/secret.tf | 6 ++++ password-store/put/variables.tf | 26 ++++++++++++++++ 8 files changed, 103 insertions(+) create mode 100644 password-store/put/.terraform.lock.hcl create mode 100644 password-store/put/.tflint.hcl create mode 100644 password-store/put/README.md create mode 100644 password-store/put/main.tf create mode 100644 password-store/put/outputs.tf create mode 100644 password-store/put/providers.tf create mode 100644 password-store/put/secret.tf create mode 100644 password-store/put/variables.tf diff --git a/password-store/put/.terraform.lock.hcl b/password-store/put/.terraform.lock.hcl new file mode 100644 index 0000000..ae17466 --- /dev/null +++ b/password-store/put/.terraform.lock.hcl @@ -0,0 +1,10 @@ +# This file is maintained automatically by "terraform init". +# Manual edits may be lost in future updates. + +provider "registry.terraform.io/mecodia/pass" { + version = "3.1.0" + constraints = "~> 3.1.0" + hashes = [ + "h1:kyFSE+h7PVSvQXWmEdw6KTQP29JF+t+oJgNx0YUJhB0=", + ] +} diff --git a/password-store/put/.tflint.hcl b/password-store/put/.tflint.hcl new file mode 100644 index 0000000..e69de29 diff --git a/password-store/put/README.md b/password-store/put/README.md new file mode 100644 index 0000000..d869ff4 --- /dev/null +++ b/password-store/put/README.md @@ -0,0 +1,43 @@ +# password-store secret writter module + +Put a secret into a password-store repository. + +## Requirements + +| Name | Version | +|------|---------| +| [terraform](#requirement\_terraform) | ~> 1.3 | +| [pass](#requirement\_pass) | ~> 3.1.0 | + +## Providers + +| Name | Version | +|------|---------| +| [pass](#provider\_pass) | ~> 3.1.0 | + +## Modules + +No modules. + +## Resources + +| Name | Type | +|------|------| +| [pass_password.secret](https://registry.terraform.io/providers/mecodia/pass/latest/docs/resources/password) | resource | + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [data](#input\_data) | Additional key-value pairs to store with the password | `map(string)` | `null` | no | +| [password](#input\_password) | Password to store | `string` | `null` | no | +| [path](#input\_path) | Password Store path to the secret | `string` | n/a | yes | +| [yaml](#input\_yaml) | YAML representation of the secret | `string` | `null` | no | + +## Outputs + +| Name | Description | +|------|-------------| +| [body](#output\_body) | The body of the secret | +| [full](#output\_full) | Entire secret contents | + diff --git a/password-store/put/main.tf b/password-store/put/main.tf new file mode 100644 index 0000000..e69de29 diff --git a/password-store/put/outputs.tf b/password-store/put/outputs.tf new file mode 100644 index 0000000..023e27b --- /dev/null +++ b/password-store/put/outputs.tf @@ -0,0 +1,9 @@ +output "body" { + description = "The body of the secret" + value = resource.pass_password.secret.body +} + +output "full" { + description = "Entire secret contents" + value = resource.pass_password.secret.full +} diff --git a/password-store/put/providers.tf b/password-store/put/providers.tf new file mode 100644 index 0000000..5a780f8 --- /dev/null +++ b/password-store/put/providers.tf @@ -0,0 +1,9 @@ +terraform { + required_version = "~> 1.3" + required_providers { + pass = { + source = "mecodia/pass" + version = "~> 3.1.0" + } + } +} diff --git a/password-store/put/secret.tf b/password-store/put/secret.tf new file mode 100644 index 0000000..f416de2 --- /dev/null +++ b/password-store/put/secret.tf @@ -0,0 +1,6 @@ +resource "pass_password" "secret" { + path = var.path + data = var.data + password = var.password + yaml = var.yaml +} diff --git a/password-store/put/variables.tf b/password-store/put/variables.tf new file mode 100644 index 0000000..e1060df --- /dev/null +++ b/password-store/put/variables.tf @@ -0,0 +1,26 @@ +# bellow are specific modules variables +variable "path" { + description = "Password Store path to the secret" + type = string +} + +variable "data" { + description = "Additional key-value pairs to store with the password" + type = map(string) + sensitive = true + default = null +} + +variable "password" { + description = "Password to store" + type = string + sensitive = true + default = null +} + +variable "yaml" { + description = "YAML representation of the secret" + type = string + sensitive = true + default = null +}