This is an unofficial Terraform provider for Junos devices with netconf protocol
See website or Terraform registry for provider and resources documentation.
- Go 1.15
Add source information inside the Terraform configuration block for automatic provider installation:
terraform {
required_providers {
junos = {
source = "jeremmfr/junos"
}
}
}Download latest version in releases
Extract provider binary in local mirror directory with a fake registry (registry.local):
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}
doneand add inside the terraform configuration block:
terraform {
required_providers {
junos = {
source = "registry.local/jeremmfr/junos"
}
}
}Extract provider binary beside terraform binary:
tfPath=$(which terraform | rev | cut -d'/' -f2- | rev)
unzip terraform-provider-junos*.zip -d ${tfPath}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.
To contribute, please read the contribution guideline
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 installgit 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 tfPathand add inside the terraform configuration block:
terraform {
required_providers {
junos = {
source = "registry.local/jeremmfr/junos"
}
}
}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=$(which terraform | rev | cut -d'/' -f2- | rev)
go build -o ${tfPath}/terraform-provider-junos_${latestTag}
unset latestTag tfPath
