Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
killmeplz committed Jun 24, 2022
0 parents commit 2e28fdf
Show file tree
Hide file tree
Showing 12 changed files with 682 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# This GitHub action can publish assets for release when a tag is created.
# Currently its setup to run on any tag that matches the pattern "v*" (ie. v0.1.0).
#
# This uses an action (hashicorp/ghaction-import-gpg) that assumes you set your
# private key in the `GPG_PRIVATE_KEY` secret and passphrase in the `PASSPHRASE`
# secret. If you would rather own your own GPG handling, please fork this action
# or use an alternative one for key handling.
#
# You will need to pass the `--batch` flag to `gpg` in your signing step
# in `goreleaser` to indicate this is being used in a non-interactive mode.
#
name: release
on:
push:
tags:
- 'v*'
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Unshallow
run: git fetch --prune --unshallow
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version-file: 'go.mod'
cache: true
- name: Import GPG key
id: import_gpg
uses: hashicorp/[email protected]
env:
# These secrets will need to be configured for the repository:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
- name: Run GoReleaser
uses: goreleaser/[email protected]
with:
version: latest
args: release --rm-dist
env:
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
# GitHub sets this automatically
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20 changes: 20 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
### Go template
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Dependency directories (remove the comment below to include it)
# vendor/

.idea

terraform-provider-sodium
30 changes: 30 additions & 0 deletions docs/data-sources/encrypted_item.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---

# generated by https://github.com/hashicorp/terraform-plugin-docs

page_title: "sodium_encrypted_item Data Source - terraform-provider-sodium"
subcategory: ""
description: |- Encrypt a string value with given public key using sodium library
---

# sodium_encrypted_item (Data Source)

Encrypt a string value with given public key using sodium library



<!-- schema generated by tfplugindocs -->

## Schema

### Required

- `content_base64` (String, Sensitive) Base64 encoded version of the raw string to encrypt.
- `public_key` (String) Public key to use when encrypting

### Read-Only

- `encrypted_value_base64` (String, Sensitive) Base64 encoded version of the encrypted result .
- `id` (String) The ID of this resource.


15 changes: 15 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---

# generated by https://github.com/hashicorp/terraform-plugin-docs

page_title: "sodium Provider"
subcategory: ""
description: |-
---

# sodium Provider

<!-- schema generated by tfplugindocs -->

## Schema
36 changes: 36 additions & 0 deletions example/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
### Terraform template
# Local .terraform directories
**/.terraform/*

# .tfstate files
*.tfstate
*.tfstate.*

# Crash log files
crash.log

# Exclude all .tfvars files, which are likely to contain sentitive data, such as
# password, private keys, and other secrets. These should not be part of version
# control as they are data points which are potentially sensitive and subject
# to change depending on the environment.
#
*.tfvars

# Ignore override files as they are usually used to override resources locally and so
# are not checked in
override.tf
override.tf.json
*_override.tf
*_override.tf.json

# Include override files you do wish to add to version control using negated pattern
#
# !example_override.tf

# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
# example: *tfplan*

# Ignore CLI configuration files
.terraformrc
terraform.rc

37 changes: 37 additions & 0 deletions example/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
terraform {
required_providers {
sodium = {
source = "github.com/sodiumprovider/sodium"
}
github = {
source = "integrations/github"
version = ">= 4.5.2"
}
}
}

provider "github" {
owner = "org_name"
token = "github_token"
}


# To make sure the repository exists and the correct permissions are set.
data "github_repository" "main" {
full_name = "org_name/repo_name"
}

data "github_actions_public_key" "gh_actions_public_key" {
repository = "repo_name"
}

data "sodium_encrypted_item" "foo" {
public_key = data.github_actions_public_key.gh_actions_public_key.key
content_base64 = base64encode("SuperSecretPassword")
}

resource "github_actions_secret" "gh_actions_secret" {
repository = "repo_name"
secret_name = "SECRET_FOO"
encrypted_value = data.sodium_encrypted_item.foo.encrypted_value_base64
}
52 changes: 52 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
module github.com/killmeplz/terraform-provider-sodium

go 1.17

require (
github.com/hashicorp/terraform-plugin-sdk/v2 v2.17.0
golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e
)

require (
github.com/agext/levenshtein v1.2.2 // indirect
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
github.com/fatih/color v1.7.0 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/go-cmp v0.5.8 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 // indirect
github.com/hashicorp/go-hclog v1.2.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-plugin v1.4.4 // indirect
github.com/hashicorp/go-uuid v1.0.3 // indirect
github.com/hashicorp/go-version v1.5.0 // indirect
github.com/hashicorp/hcl/v2 v2.12.0 // indirect
github.com/hashicorp/logutils v1.0.0 // indirect
github.com/hashicorp/terraform-plugin-go v0.9.1 // indirect
github.com/hashicorp/terraform-plugin-log v0.4.0 // indirect
github.com/hashicorp/terraform-registry-address v0.0.0-20210412075316-9b2996cce896 // indirect
github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 // indirect
github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d // indirect
github.com/kr/pretty v0.2.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/mattn/go-colorable v0.1.4 // indirect
github.com/mattn/go-isatty v0.0.10 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
github.com/mitchellh/go-wordwrap v1.0.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/oklog/run v1.0.0 // indirect
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
github.com/vmihailenco/msgpack/v4 v4.3.12 // indirect
github.com/vmihailenco/tagparser v0.1.1 // indirect
github.com/zclconf/go-cty v1.10.0 // indirect
golang.org/x/net v0.0.0-20210326060303-6b1517762897 // indirect
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 // indirect
golang.org/x/text v0.3.5 // indirect
google.golang.org/appengine v1.6.6 // indirect
google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d // indirect
google.golang.org/grpc v1.46.0 // indirect
google.golang.org/protobuf v1.28.0 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
)
Loading

0 comments on commit 2e28fdf

Please sign in to comment.