Terraform provider for Netbox.
- A libc library like libc6-compat or libc-utils
- General developer tools like make, bash, ... (to build the provider)
- Go 1.15 minimum (to build the provider)
- Terraform (to use the provider)
Version 0.x.y => Netbox 2.8
Version 1.x.y => Netbox 2.9
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
NOTE
Before changing the version of the provider, please remove the temporary folder .terraform
and ~/.terraform.d
.
terraform {
required_providers {
netbox = {
source = "smutel/netbox"
version = "0.2.1"
}
}
}
You can install the provider manually in your global terraform provider folder.
$ export NETBOX_PROVIDER_VERSION=1.0.0
$ mkdir -p ~/.terraform.d/plugins/registry.terraform.io/smutel/netbox/${NETBOX_PROVIDER_VERSION}/linux_amd64
$ cp terraform-provider-netbox_v${NETBOX_PROVIDER_VERSION} ~/.terraform.d/plugins/registry.terraform.io/smutel/netbox/${NETBOX_PROVIDER_VERSION}/linux_amd64/terraform-provider-netbox_v${NETBOX_PROVIDER_VERSION}
$ make localinstall
==> Creating folder ~/.terraform.d/plugins/registry.terraform.io/smutel/netbox/0.0.1/linux_amd64
==> Installing provider in this folder
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
- Closed - Issue 85 in project go-netbox
- Closed - Issue 54 in project go-netbox
- Open - Issue 115 in project go-netbox
- Closed - Issue 100 in project go-netbox
- json: cannot unmarshal number into Go struct field <field>.results.connected_endpoint of type string
- Currently causes issues for Circuits/CircuitTerminations, DCIM/Cables, DCIM/Interfaces, and Extras/ObjectChanges