GithubHelp home page GithubHelp logo

secrets-vault's Introduction

Secrets Vault

Actions Status Actions Status

Put your secrets in git. Why not, right?

Usage

The point of secrets-vault is to keep your secrets managed like code.

It does this by storing secrets in Ansible Vault files.

If it only did this, though, a code reviewer wouldn't have a clue what's going on. So it also adds a plaintext schema file, which describes what secrets are in each vault file. Then it has a "lint" mode to match up the schema files with the vault contents - so a code reviewer can just glance over the action result and know that any secrets are in place and ready.

Each "environment" listed in the main config file will be checked in lint mode. In the normal, export mode, it just exports a single environment.

To avoid duplication, each environment can have a "parent", from which it gains a common set of secrets.

Secrets can be added to this base, or overridden - but a schema can define a secret as "final" (so an attempt to override it will fail), or optional if it doesn't need a value.

Finally, secrets can be not actually secret at all. In that case, you can set the mask to False, and even provide a value.

The Files

The files all live in ".github/secrets-vault" by default.

First, you'll need main_config.yml, which contains a single key environments, a list of environment names. You only need to list the leaf environments she actually use directly; ones just used as parents you can leave out.

Each environment - whether that's a leaf or not - needs two files. First, a schema file, a YAML file called after the environment, like prod.yml for prod.

Here's an example:

parent: main
secrets:
  foo:
    description: You can put some helpful stuff here.
    optional: False
    final: True

Then you'll need a vault file. That's a simple key-value YAML file, encrypted as an ansible vault.

Example workflow

name: My Workflow
on: [push, pull_request]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master
    - name: Run action

      uses: dwd/secrets-vault@master
      id: secrets
      with:
        vault_key: ${secrets.vault_key}
        environment: prod-eu

Inputs

Input Description
vault_key The key for all your ansible vaults. Do me a favour, keep this in a Github Secret.
environment (optional) The environment you want to export, assuming export mode. If you don't supply one, it'll use main
mode (optional) The mode to run in. Either export (the default) or lint

Outputs

Outputs are your secrets.

Examples

Using outputs

- name: Check outputs
  run: |
    echo "Outputs - ${{ steps.secrets.outputs.foo }}"

secrets-vault's People

Contributors

dwd avatar

Stargazers

Dan Caseley avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.