terraform-provider-bitwarden

command module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 16, 2022 License: MPL-2.0 Imports: 5 Imported by: 0

README

Terraform Provider for Bitwarden

The Terraform Bitwarden provider is a plugin for Terraform that allows to manage different kind of Bitwarden resources.

This project is not associated with the Bitwarden project nor 8bit Solutions LLC.

Requirements

The provider might work with older versions but those haven't been tested.

Usage

Detailed documentation for using this provider can be found on the Terraform Registry docs.

# Bitwarden Credentials
variable "bw_password" {
  type        = string
  description = "Bitwarden Master Key"
  sensitive   = true
}

variable "bw_client_id" {
  type        = string
  description = "Bitwarden Client ID"
  sensitive   = true
}

variable "bw_client_secret" {
  type        = string
  description = "Bitwarden Client Secret"
  sensitive   = true
}

# Provider configuration
terraform {
  required_providers {
    bitwarden = {
      source  = "maxlaverse/bitwarden"
      version = "0.0.1"
    }
  }
  required_version = ">= 1.0.2"
}

provider "bitwarden" {
  master_password = var.bw_password
  client_id       = var.bw_client_id
  client_secret   = var.bw_client_secret
  email           = "test@laverse.net"
  server          = "https://vault.bitwarden.com"
}

# Save sensitive Terraform generated data to Bitwarden
resource "bitwarden_folder" "terraform-bw-folder" {
  name = "Terraform Generated"
}

resource "bitwarden_item_login" "vpn-read-only-userpwd" {
  name      = "VPN Read Only User/Password Access"
  username  = "vpn-read-only"
  password  = <some_other_plugin>.user-read-only.secret
  folder_id = bitwarden_folder.terraform-bw-folder.id
}

resource "bitwarden_item_secure_note" "vpn-read-only-certs" {
  name      = "VPN Read Only Certificate Access"
  notes     = <some_other_plugin>.user-read-only.private_key
  folder_id = bitwarden_folder.terraform-bw-folder.id
}

# Read sensitive information from Bitwarden
data "bitwarden_item_login" "mysql-root-credentials" {
  id = "ec4e447f-9aed-4203-b834-c8f3848828f7"
}

# Later to be accessed as
#   ... = data.bitwarden_item_login.mysql-root-credentials.username
#   ... = data.bitwarden_item_login.mysql-root-credentials.password

data "bitwarden_item_secure_note" "ssh-private-key" {
  id = "a9e19f26-1b8c-4568-bc09-191e2cf56ed6"
}

# ....

See the examples directory for a full example.

Developing the Provider

If you wish to work on the provider, you'll first need Go installed on your machine (see Requirements above).

To compile the provider, run go install. This will build the provider and put the provider binary in the $GOPATH/bin directory.

To generate or update documentation, run go generate.

In order to run the full suite of Acceptance tests, run make testacc.

$ make testacc

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL