Skip to content

tomasherout/terraform-provider-netbox

 
 

Repository files navigation

terraform-provider-netbox

Lisence Conventional Commits Build Status Go Report Card

Terraform provider for Netbox.

Requirements

  • General developper tools like make, bash, ...
  • Go 1.13 minimum (to build the provider)
  • Terraform (to use the provider)

Compatibility with Netbox

Version 0.x.x => Netbox 2.8.x

Building the provider

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

Installing the provider

Automatic installation from Terraform 0.13

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

Using the provider

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

Contributing to this project

To contribute to this project, please follow the conventional commits rules.

Examples

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

Known bugs in external project which can impact this provider

About

Terraform provider for Netbox

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 97.8%
  • Makefile 2.2%