/terraform-provider-berglas

A Terraform provider for Berglas

Primary LanguageGoApache License 2.0Apache-2.0

Terraform Berglas Provider

This is a Terraform provider for interacting with Berglas.

Secrets will be stored in plaintext in the Terraform state. You should only use this with provider with Terraform remote state. For more information, please see sensitive state.

Installation

  1. Download the latest compiled binary from GitHub releases.

  2. Unzip/untar the archive.

  3. Move it into $HOME/.terraform.d/plugins:

    $ mkdir -p $HOME/.terraform.d/plugins
    $ mv terraform-provider-berglas $HOME/.terraform.d/plugins/terraform-provider-berglas
  4. Create your Terraform configurations as normal, and run terraform init:

    $ terraform init

    This will find the plugin locally.

  5. If you haven't already, bootstrap berglas

Optionally

If using terraform v0.13+ you can create a versions.tf file to pull the plugin during terraform init without installing it locally:

terraform {
  required_providers {
    berglas = {
      source  = "sethvargo/berglas"
      version = "~> 0.1"
    }
  }
}

Usage

  1. Create a Terraform configuration file:

    resource "berglas_secret" "demo" {
      bucket    = "my-bucket"
      key       = "projects/${var.project_id}/locations/global/keyRings/berglas/cryptoKeys/berglas-key"
      name      = "demo"
      plaintext = "p@s$w0rd!"
    }
  2. Run terraform init to pull in the provider:

    $ terraform init
  3. Run terraform plan and terraform apply:

    $ terraform plan
    
    $ terraform apply

Examples

For more examples, please see the examples folder in this repository.

Reference

See the documentation.