Skip to content

jeremmfr/terraform-provider-junos

Repository files navigation

Junos logo Terraform logo

terraform-provider-junos

Release Installs Registry License
Go Status Linters Status Go Report Card
Buy Me A Coffee


This is an unofficial Terraform provider for Junos devices with netconf protocol

See Terraform registry for provider and resources documentation.

Requirements

In addition to develop

  • Go v1.22 or v1.23

Automatic install

Add source information inside the Terraform configuration block for automatic provider installation:

terraform {
  required_providers {
    junos = {
      source = "jeremmfr/junos"
    }
  }
}

Manual install

for archive in $(ls terraform-provider-junos*.zip) ; do
  OS_ARCH=$(echo $archive | cut -d'_' -f3-4 | cut -d'.' -f1)
  VERSION=$(echo $archive | cut -d'_' -f2)
  tfPath="${HOME}/.terraform.d/plugins/registry.local/jeremmfr/junos/${VERSION}/${OS_ARCH}/"
  mkdir -p ${tfPath}
  unzip ${archive} -d ${tfPath}
done
  • Add inside the terraform configuration block:
terraform {
  required_providers {
    junos = {
      source = "registry.local/jeremmfr/junos"
    }
  }
}

Missing Junos parameters

Some Junos parameters are not included in provider for various reasons (time, utility, understanding, ...) but you can create a issue to request the potential addition of missing features.

Contributing

To contribute, please read the contribution guideline

Compile a binary from source to use with Terraform

Build to override automatic install version (Terraform 0.14 and later)

Since Terraform 0.14, development overrides for provider developers allow to use the provider built from source.
Use a Terraform cli configuration file (~/.terraformrc by default) with at least the following options:

provider_installation {
  dev_overrides {
    "jeremmfr/junos" = "[replace with the GOPATH]/bin"
  }
  direct {}
}

and build then install in $GOPATH/bin:

git clone https://github.com/jeremmfr/terraform-provider-junos.git
cd terraform-provider-junos
go install

Build to use with a fake registry (Terraform 0.13)

git clone https://github.com/jeremmfr/terraform-provider-junos.git
cd terraform-provider-junos && git fetch --tags
latestTag=$(git describe --tags `git rev-list --tags --max-count=1`)
git checkout ${latestTag}
tfPath="${HOME}/.terraform.d/plugins/registry.local/jeremmfr/junos/${latestTag:1}/$(go env GOOS)_$(go env GOARCH)/"
mkdir -p ${tfPath}
go build -o ${tfPath}/terraform-provider-junos_${latestTag}
unset latestTag tfPath

and add inside the terraform configuration block:

terraform {
  required_providers {
    junos = {
      source = "registry.local/jeremmfr/junos"
    }
  }
}