In this repo, you'll find the source code for the Border0 Terraform Provider. With this provider, you can provision and manage Border0 resources, such as sockets, policies, and connectors, using Terraform.
Copy the following code to your terraform config and run terraform init
:
terraform {
required_providers {
border0 = {
source = "borderzero/border0"
}
}
}
provider "border0" {
// Border0 access token. Required.
// If not set explicitly, the provider will use the env var BORDER0_TOKEN.
//
// You can generate a Border0 access token one by going to:
// portal.border0.com -> Organization Settings -> Access Tokens
// and then create a token in Member permission groups.
token = "_my_access_token_"
}
And explore the examples folder for additional use cases and examples. For a comprehensive step-by-step guide, check out our Quickstart Guide on docs.border0.com.
To (re)generate docs, install tfplugindocs
first:
go install github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs@latest
And then run:
make docs
Make the changes you'd like!
Then, navigate to the examples/development directory:
cd examples/development
Install a border0 terraform provider (which includes your local changes):
make init
Log in to border0
make token
Apply the development setup:
make apply
Destroy the development setup:
make destroy
Install goreleaser:
brew install goreleaser
Run local release command and build terraform provider binaries
make release
You will find the releases in the /dist
directory. You will need to rename the provider binary to terraform-provider-border0
and move the binary into
the appropriate subdirectory within the user plugins directory.
Configuration examples can be tested with a local build of this terraform provider.
First, build and install the provider.
make install
Then, navigate to the examples directory.
cd examples
Run the following command to initialize the workspace and apply the sample configuration.
terraform init && terraform apply
Some different variations:
# run against prod api
BORDER0_TOKEN=_border0_auth_token_ terraform apply
# run with a local dev api that's listening to localhost:8080
BORDER0_TOKEN=_border0_auth_token_ BORDER0_API=http://localhost:8080/api/v1 terraform apply
Create a new tag. Assuming the next release is v1.1.1
.
git tag v1.1.1
Push the tag to GitHub.
git push origin v1.1.1
It will trigger the GitHub Actions release
workflow.