The Terraform Provider for EJBCA uses Terraform Plugin Protocol version 6 and is only compatible with Terraform 1.0 and later.
The first step of installing the Keyfactor EJBCA Terraform Provider is to require the provider in your Terraform configuration file.
terraform {
required_providers {
ejbca = {
source = "registry.terraform.io/keyfactor-pub/ejbca"
}
}
}Run terraform init to initialize the provider. Terraform will automatically download the provider and install it in the
.terraform directory in your current working directory.
To build and install the provider from source, clone the repository to your local machine and configure Terraform manually.
-
Clone the GitHub repo and compile the provider.
git clone https://github.com/keyfactor-pub/terraform-provider-ejbca.git cd terraform-provider-ejbca make build -
Move the binary to the plugin directory
mkdir -p "$HOME/.terraform.d/plugins/registry.terraform.io/keyfactor-pub/ejbca/1.0.0/$(go env GOOS)_$(go env GOARCH)" mv "bin/terraform-provider-ejbca" "$HOME/.terraform.d/plugins/registry.terraform.io/keyfactor-pub/ejbca/1.0.0/$(go env GOOS)_$(go env GOARCH)"
-
Create or modify a
.terraformrcfilecat <<EOF > "$HOME/.terraformrc" provider_installation { filesystem_mirror { path = "$HOME/.terraform.d/plugins" include = ["registry.terraform.io/keyfactor-pub/ejbca"] } direct { exclude = ["registry.terraform.io/keyfactor-pub/ejbca"] } } EOF
-
Initialize the provider
[ -f .terraform.lock.hcl ] && echo "Removing .terraform.lock.hcl" && rm .terraform.lock.hcl terraform init -upgrade