Skip to content

zorro-fr24/terraform-provider-junos

 
 

Repository files navigation

Junos logo Terraform logo

terraform-provider-junos

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

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

See website or Terraform registry for provider and resources documentation.

Requirements

In addition to develop

Automatic install (Terraform 0.13 and later)

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

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

Manual install

Download latest version in releases

Terraform 0.13 and later

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}
done

and add inside the terraform configuration block:

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

Terraform 0.12 and earlier

Extract provider binary beside terraform binary:

tfPath=$(which terraform | rev | cut -d'/' -f2- | rev)
unzip terraform-provider-junos*.zip -d ${tfPath}

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 and later)

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"
    }
  }
}

Build with output beside terraform binary (Terraform 0.12 and earlier)

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

About

Terraform's provider for Junos devices

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Go 99.1%
  • HTML 0.9%