Terraform provider for Netbox.
- General developper tools like make, bash, ...
- Go 1.13 minimum (to build the provider)
- Terraform (to use the provider)
Version 0.x.x => Netbox 2.8.x
Clone repository to: $GOPATH/src/github.com/smutel/terraform-provider-netbox
$ mkdir -p $GOPATH/src/github.com/smutel
$ cd $GOPATH/src/github.com/smutel
$ git clone [email protected]:smutel/terraform-provider-netbox.git
Enter the provider directory and build the provider
$ cd $GOPATH/src/github.com/smutel/terraform-provider-netbox
$ make build
terraform {
required_providers {
netbox = {
source = "smutel/netbox"
version = "0.2.1"
}
}
}
### Manual installation
You can install the provider manually in your global terraform provider folder or you can also use the makefile to install the provider in your local provider folder:
$ make localinstall
==> Creating folder terraform.d/plugins/linux_amd64
mkdir -p ~/.terraform.d/plugins/linux_amd64
==> Installing provider in this folder
cp terraform-provider-netbox ~/.terraform.d/plugins/linux_amd64
The definition of the provider is optional.
All the parameters could be setup by environment variables.
provider netbox {
# Environment variable NETBOX_URL
url = "127.0.0.1:8000"
# Environment variable NETBOX_TOKEN
token = "c07a2db4adb8b1e7f75e7c4369964e92f7680512"
# Environment variable NETBOX_SCHEME
scheme = "http"
}
For further information, check this documentation
To contribute to this project, please follow the conventional commits rules.
You can find some examples in the examples folder.
Each example can be executed directly with command terraform init & terraform apply.
You can set different environment variables for your test:
- NETBOX_URL to define the URL and the port (127.0.0.1:8000 by default)
- NETBOX_TOKEN to define the TOKEN to access the application (empty by default)
- NETBOX_SCHEME to define the SCHEME of the URL (https by default)
$ export NETBOX_URL="127.0.0.1:8000"
$ export NETBOX_TOKEN="c07a2db4adb8b1e7f75e7c4369964e92f7680512"
$ export NETBOX_SCHEME="http"
$ cd examples
$ terraform init & terraform apply