Use the 1Password Connect Terraform Provider to reference, create, or update items in your 1Password Vaults.
To build the 1Password Connect Terraform provider run the following
$ go build .
This will create the terraform-provider-onepassword
binary
To run the go tests and check test coverage run the following
$ go test -v ./... -cover
To install the binary it must be copied to the appropriate terraform plugin directory. You may need to create the appropriate directories. For more information see these Terraform 0.13 plugin docs
The current version of the provider is considered to be 0.2 and darwin_amd64
should match your machines operating system and architecture in the format $OS_$ARCH
. For example macOS is darwin_amd64
and linux is linux_amd64
.
$ mkdir -p ~/.terraform.d/plugins/github.com/1Password/onepassword/0.2/darwin_amd64/
$ cp ./terraform-provider-onepassword ~/.terraform.d/plugins/github.com/1Password/onepassword/0.2/darwin_amd64/terraform-provider-onepassword
In your Terraform configuration you will need to specify the op plugin with
terraform {
required_providers {
onepassword = {
version = "0.2"
source = "github.com/1Password/onepassword"
}
}
}
provider "onepassword" {
url = "http://<1Password Connect API Hostname>"
}
After copying a newly built version of the provider to the plugins directory you will have to run terraform init
again. If you forget to do this terraform will error out and tell you to do so.