Giter VIP home page Giter VIP logo

terraform-provider-ansiblevault's Introduction

terraform-provider-ansiblevault

Build Status codecov Go Report Card

This Terraform provider allows you to access secrets from an Ansible Vault from Terraform.

Made with ❤️ by MeilleursAgents

Thanks

Thanks to ansible-vault-go repository for having done the hardest part.

Installation

Golang Way

If you have Golang installed

go install github.com/MeilleursAgents/terraform-provider-ansiblevault
mkdir -p "~/.terraform.d/plugins/$(go env GOHOSTOS)_$(go env GOHOSTARCH)/"
cp ${GOPATH}/bin/terraform-provider-ansiblevault "~/.terraform.d/plugins/$(go env GOHOSTOS)_$(go env GOHOSTARCH)/"

or

In the repository

make build
make install

Without golang

PLUGIN_VERSION="1.0.1"
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m | tr '[:upper:]' '[:lower:]')

if [[ "${ARCH}" = "x86_64" ]]; then
  ARCH="amd64"
fi

pushd $HOME
mkdir -p ".terraform.d/plugins/${OS}_${ARCH}/"
cd ".terraform.d/plugins/${OS}_${ARCH}/"
curl -o "terraform-provider-ansiblevault_v${PLUGIN_VERSION}" "https://github.com/MeilleursAgents/terraform-provider-ansiblevault/releases/download/v${PLUGIN_VERSION}/terraform-provider-ansiblevault_${OS}-${ARCH}_v${PLUGIN_VERSION}"
popd

Usage

ansiblevault_env example:


provider "ansiblevault" {
  vault_pass  = "/home/username/.vault_pass.txt"
  root_folder = "/home/username/infra/ansible/"
}

data "ansiblevault_env" "api_key" {
  env = "prod"
  key = "SECRET_API_KEY"
}

${data.ansiblevault_env.api_key.value}

ansiblevault_path example:


provider "ansiblevault" {
  vault_pass  = "/home/username/.vault_pass.txt"
  root_folder = "/home/username/infra/ansible/"
}

data "ansiblevault_path" "api_key" {
  path = "./passwords.yml"
  key = "USER_PASSWORD"
}

${data.ansiblevault_path.api_key.value}

Build and Deploy

You need following environment variables for doing a release. If not set, the release script will ask you.

Name Description
GITHUB_OAUTH_TOKEN A Github Token with repos access
GITHUB_REPOSITORY The repository name for uploading assets (e.g. MeilleursAgents/terraform-provider-ansiblevault)
GIT_TAG The new version to release (e.g. v1.0.0)
RELEASE_NAME The version name (most of the time, the git tag)
git tag "${GIT_TAG}"
GITHUB_REPOSITORY=MeilleursAgents/terraform-provider-ansiblevault ./script/release

Contribution

You have to enable Go modules for compiling this project.

License

This project is licensed under the MIT license (see LICENSE file).

FOSSA Status

terraform-provider-ansiblevault's People

Contributors

airbe avatar bdronneau avatar bmeriaux avatar corenting avatar vibioh 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.