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.
The plugin has been tested and built with the following components:
- Terraform v1.6.1
- Bitwarden CLI v2023.2.0
- Go 1.22.0 (for development)
- Docker 23.0.5 (for development)
The provider likely works with older versions but those haven't been tested.
The complete documentation for this provider can be found on the Terraform Registry docs.
terraform {
required_providers {
bitwarden = {
source = "maxlaverse/bitwarden"
version = ">= 0.8.0"
}
}
}
# Configure the Bitwarden Provider
provider "bitwarden" {
email = "[email protected]"
}
# Create a Bitwarden Login item
resource "bitwarden_item_login" "example" {
name = "Example"
username = "service-account"
password = "<sensitive>"
}
# or use an existing Bitwarden resource
data "bitwarden_item_login" "example" {
search = "Example"
}
See the examples directory for more examples.
The Terraform Bitwarden provider entirely relies on the Bitwarden CLI to interact with Vaults. When you ask Terraform to plan or apply changes, the provider downloads the encrypted Vault locally as if you would use the Bitwarden CLI directly. Currently, the Terraform SDK doesn't offer a way to remove the encrypted Vault once changes have been applied. The issue hashicorp/terraform-plugin-sdk#63 tracks discussions for adding such a feature.
If you want find out more about this file, you can read Terraform's documentation on Data Storage.
Please note that this file is stored at <your-project>/.bitwarden/
by default, in order to not interfer with your local Vaults.
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, start a Vaultwarden server:
$ docker run -ti \
-e I_REALLY_WANT_VOLATILE_STORAGE=true \
-e DISABLE_ICON_DOWNLOAD=false \
-e ADMIN_TOKEN=test1234 \
-e LOGIN_RATELIMIT_SECONDS=1 \
-e LOGIN_RATELIMIT_MAX_BURST=1000000 \
-e ADMIN_RATELIMIT_SECONDS=1 \
-e ADMIN_RATELIMIT_MAX_BURST=1000000 \
--mount type=tmpfs,destination=/data \
-p 8080:80 vaultwarden/server
Then run make testacc
.
$ make testacc
Distributed under the Mozilla License. See LICENSE for more information.