Skip to content

Commit

Permalink
Merge pull request #291 from jeremmfr/main
Browse files Browse the repository at this point in the history
Release v1.21.0
  • Loading branch information
jeremmfr authored Oct 12, 2021
2 parents d2b0c79 + b592b69 commit 5a8d419
Show file tree
Hide file tree
Showing 134 changed files with 3,124 additions and 1,112 deletions.
26 changes: 16 additions & 10 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,33 @@
name: Go Tests
on: [push, pull_request]
jobs:
build-1_15:
name: Build 1.15
build-1_16:
name: Build 1.16
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.15
- name: Set up Go 1.16
uses: actions/setup-go@v1
with:
go-version: 1.15
go-version: 1.16
id: go
- name: Show version
run: go version
- name: Check out code
uses: actions/checkout@v2
- name: Build
run: go build -v .

build-1_16:
name: Build 1.16
build-1_17:
name: Build 1.17
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.16
- name: Set up Go 1.17
uses: actions/setup-go@v1
with:
go-version: 1.16
go-version: 1.17
id: go
- name: Show version
run: go version
- name: Check out code
uses: actions/checkout@v2
- name: Build
Expand All @@ -33,11 +37,13 @@ jobs:
name: Test
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.16
- name: Set up Go 1.17
uses: actions/setup-go@v1
with:
go-version: 1.16
go-version: 1.17
id: go
- name: Show version
run: go version
- name: Check out code
uses: actions/checkout@v2
- name: Test
Expand Down
12 changes: 8 additions & 4 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@ jobs:
name: terrafmt
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.16
- name: Set up Go 1.17
uses: actions/setup-go@v2
with:
go-version: 1.16
go-version: 1.17
id: go
- name: Show version
run: go version
- name: Check out code
uses: actions/checkout@v2
- name: Check out terrafmt code
Expand Down Expand Up @@ -61,11 +63,13 @@ jobs:
name: tfproviderlint
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.16
- name: Set up Go 1.17
uses: actions/setup-go@v2
with:
go-version: 1.16
go-version: 1.17
id: go
- name: Show version
run: go version
- name: Check out code
uses: actions/checkout@v2
- name: Check out tfproviderlint code
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,13 @@ jobs:
- goos: windows
goarch: arm64
steps:
- name: Set up Go 1.16
- name: Set up Go 1.17
uses: actions/setup-go@v1
with:
go-version: 1.16
go-version: 1.17
id: go
- name: Show version
run: go version
- name: Check out code
uses: actions/checkout@v2
- name: Set env
Expand Down
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ linters:
- gci
- cyclop
- forcetypeassert
- gomoddirectives
linters-settings:
gocognit:
# minimal code complexity to report, 30 by default
Expand Down
26 changes: 26 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,32 @@ ENHANCEMENTS:

BUG FIXES:

## 1.21.0 (October 12, 2021)

FEATURES:

* add `junos_security_nat_static_rule` resource (Fixes [#281](https://github.com/jeremmfr/terraform-provider-junos/issues/281))

ENHANCEMENTS:

* resource/`*`: to avoid any confusion, the provider now detects and generates an error during `apply` when there are duplicate elements (with the same identifier, for example the same `name`) in the block lists of certain resources
* resource/`junos_routing_instance`: add `instance_export` and `instance_import` arguments (Fixes [#280](https://github.com/jeremmfr/terraform-provider-junos/issues/280))
* resource/`junos_routing_options`: add `instance_export` and `instance_import` arguments
* resource/`junos_security_address_book`: add `address_set` argument inside `address_set` block (Fixes [#287](https://github.com/jeremmfr/terraform-provider-junos/issues/287))
* resource/`junos_security_nat_destination`: add multiple arguments, `application`, `destination_...`, `protocol`, `source_...` in `rule` block and `description`
* resource/`junos_security_nat_destination_pool`: add `description` argument
* resource/`junos_security_nat_source`: add multiple arguments, `application`, `destination_...`, `protocol`, `source_...` in `match` block inside `rule` block and `description`
* resource/`junos_security_nat_source_pool`: add `description` argument
* resource/`junos_security_nat_static`: add multiple arguments, `destination_...`, `source_...` in `rule` block, `mapped_port...` in `then` block, `configure_rules_singly` and `description`. also add possibility to use `prefix-name` in `then.0.type`
* resource/`junos_security_zone`: add `address_set` argument inside `address_book_set` block
* resource/`junos_security_zone_book_address_set`: add `address_set` argument
* release now with golang 1.17 and replace the terraform sdk to a fork to avoid the note `Objects have changed outside of Terraform` with the empty string lists when create resources

BUG FIXES:

* resource/`junos_ospf_area`: fix missing set interface when `interface` block have only `name` set
* resource/`junos_security_nat_source`: fix panic when `match` block inside `rule` block is empty

## 1.20.0 (September 07, 2021)

FEATURES:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ for provider and resources documentation.

### In addition to develop

- [Go](https://golang.org/doc/install) 1.15
- [Go](https://golang.org/doc/install) 1.16

## Automatic install (Terraform 0.13 and later)

Expand Down
9 changes: 6 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
module github.com/jeremmfr/terraform-provider-junos

go 1.15
go 1.16

require (
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320
github.com/hashicorp/terraform-plugin-sdk/v2 v2.7.1
github.com/hashicorp/terraform-plugin-sdk/v2 v2.8.0
github.com/jeremmfr/go-netconf v0.3.2
github.com/jeremmfr/go-utils v0.3.0
github.com/jeremmfr/junosdecode v1.1.0
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519
)

replace github.com/hashicorp/terraform-plugin-sdk/v2 v2.8.0 => github.com/jeremmfr/terraform-plugin-sdk/v2 v2.8.1-0.20211007115003-2ac7d96a040a
21 changes: 8 additions & 13 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ github.com/agext/levenshtein v1.2.1/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki
github.com/agext/levenshtein v1.2.2 h1:0S/Yg6LYmFJ5stwQeRp6EeOcCbj7xiqQSdNelsXvaqE=
github.com/agext/levenshtein v1.2.2/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558=
github.com/andybalholm/crlf v0.0.0-20171020200849-670099aa064f/go.mod h1:k8feO4+kXDxro6ErPXBRTJ/ro2mf0SsFG8s7doP9kJE=
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239 h1:kFOfPq6dUM1hTo4JG6LR5AXSUEsOjtdm0kw0FtQtMJA=
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c=
github.com/apparentlymart/go-cidr v1.0.1/go.mod h1:EBcsNrHc3zQeuaeCeCtQruQm+n9/YjEn/vI25Lg7Gwc=
github.com/apparentlymart/go-dump v0.0.0-20180507223929-23540a00eaa3/go.mod h1:oL81AME2rN47vu18xqj1S1jPIPuN7afo62yKTNn3XMM=
Expand All @@ -60,7 +59,6 @@ github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJE
github.com/apparentlymart/go-textseg/v13 v13.0.0 h1:Y+KvPE1NYz0xl601PVImeQfFyEy6iT90AvPUL1NNfNw=
github.com/apparentlymart/go-textseg/v13 v13.0.0/go.mod h1:ZK2fH7c4NqDTLtiYLvIkEghdlcqw7yxLeM89kiTRPUo=
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
github.com/aws/aws-sdk-go v1.15.78/go.mod h1:E3/ieXAlvM0XWO57iftYVDLLvQ824smPP3ATZkfNZeM=
github.com/aws/aws-sdk-go v1.25.3 h1:uM16hIw9BotjZKMZlX05SN2EFtaWfi/NonPKIARiBLQ=
Expand All @@ -87,16 +85,13 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 h1:BHsljHzVlRcyQhjrss6TZTdY2VfCqZPbv5k3iBFa2ZQ=
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=
github.com/gliderlabs/ssh v0.2.2 h1:6zsha5zo/TWhRhwqCD3+EarCAgZ2yN28ipRnGPnwkI0=
github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0=
github.com/go-git/gcfg v1.5.0 h1:Q5ViNfGF8zFgyJWPqYwA7qGFoMTEiBmdlkcfRmpIMa4=
github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E=
github.com/go-git/go-billy/v5 v5.2.0/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0=
github.com/go-git/go-billy/v5 v5.3.1 h1:CPiOUAzKtMRvolEKw+bG1PLRpT7D3LIs3/3ey4Aiu34=
github.com/go-git/go-billy/v5 v5.3.1/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0=
github.com/go-git/go-git-fixtures/v4 v4.2.1 h1:n9gGL1Ct/yIw+nfsfr8s4+sbhT+Ncu2SubfXjIWgci8=
github.com/go-git/go-git-fixtures/v4 v4.2.1/go.mod h1:K8zd3kDUAykwTdDCr+I0per6Y6vMiRR/nnVTBtavnB0=
github.com/go-git/go-git/v5 v5.4.2 h1:BXyZu9t0VkbiHtqrsvdq39UDhGJTl1h55VW6CSC4aY4=
github.com/go-git/go-git/v5 v5.4.2/go.mod h1:gQ1kArt6d+n+BGd+/B/I74HwRTLhth2+zti4ihgckDc=
Expand Down Expand Up @@ -196,10 +191,8 @@ github.com/hashicorp/terraform-exec v0.14.0 h1:UQoUcxKTZZXhyyK68Cwn4mApT4mnFPmEX
github.com/hashicorp/terraform-exec v0.14.0/go.mod h1:qrAASDq28KZiMPDnQ02sFS9udcqEkRly002EA2izXTA=
github.com/hashicorp/terraform-json v0.12.0 h1:8czPgEEWWPROStjkWPUnTQDXmpmZPlkQAwYYLETaTvw=
github.com/hashicorp/terraform-json v0.12.0/go.mod h1:pmbq9o4EuL43db5+0ogX10Yofv1nozM+wskr/bGFJpI=
github.com/hashicorp/terraform-plugin-go v0.3.0 h1:AJqYzP52JFYl9NABRI7smXI1pNjgR5Q/y2WyVJ/BOZA=
github.com/hashicorp/terraform-plugin-go v0.3.0/go.mod h1:dFHsQMaTLpON2gWhVWT96fvtlc/MF1vSy3OdMhWBzdM=
github.com/hashicorp/terraform-plugin-sdk/v2 v2.7.1 h1:vpzKKP2dIFb9n89AG8Wxl758/5JSZWZH0OuKdlq0M38=
github.com/hashicorp/terraform-plugin-sdk/v2 v2.7.1/go.mod h1:o3pdss6ynDZW9FfiZ+rETUH5LEVufrXdhwLU+5OiRo0=
github.com/hashicorp/terraform-plugin-go v0.4.0 h1:LFbXNeLDo0J/wR0kUzSPq0RpdmFh2gNedzU0n/gzPAo=
github.com/hashicorp/terraform-plugin-go v0.4.0/go.mod h1:7u/6nt6vaiwcWE2GuJKbJwNlDFnf5n95xKw4hqIVr58=
github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM=
github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d h1:kJCB4vdITiW1eC1vq2e6IsrXKrZit1bv/TDYFGMp4BQ=
github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM=
Expand All @@ -212,8 +205,12 @@ github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOl
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo=
github.com/jeremmfr/go-netconf v0.3.2 h1:9U55VX6sYCfy8JgjUxjmesoaon4cWa/jVVxFzQnTmAA=
github.com/jeremmfr/go-netconf v0.3.2/go.mod h1:AHzLyFRHXf4z7N2KK5+UYjX1bljd23tfuNq+YYRr+nA=
github.com/jeremmfr/go-utils v0.3.0 h1:f69G5Z6EnHO2bNEW+aeWB22P/4/plS1DZ2UZK7gd+WI=
github.com/jeremmfr/go-utils v0.3.0/go.mod h1:K0lGadiSvg9OKGJnW4Bs3t18/VApp/6x2+BV93Sts2M=
github.com/jeremmfr/junosdecode v1.1.0 h1:Os8QeOzyL+BPuDZJMjyJgz4QPOgA8EChgKB2Ih5wwCc=
github.com/jeremmfr/junosdecode v1.1.0/go.mod h1:nTY0XbZC2ePbZdV0wuUboSMtGrJxtpwWVYfHjrS2Oqw=
github.com/jeremmfr/terraform-plugin-sdk/v2 v2.8.1-0.20211007115003-2ac7d96a040a h1:7FBrhGngiR+2C7zs74UtCgXpzWJKX04mJN7Ry3kTxWU=
github.com/jeremmfr/terraform-plugin-sdk/v2 v2.8.1-0.20211007115003-2ac7d96a040a/go.mod h1:6KbP09YzlB++S6XSUKYl83WyoHVN4MgeoCbPRsdfCtA=
github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4=
github.com/jhump/protoreflect v1.6.0 h1:h5jfMVslIg6l29nsMs0D8Wj17RDVdNYti0vDN/PZZoE=
github.com/jhump/protoreflect v1.6.0/go.mod h1:eaTn3RZAmMBcV0fifFvlm6VHNz3wSkYyXYWUh7ymB74=
Expand All @@ -239,7 +236,6 @@ github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k=
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
github.com/matryer/is v1.2.0 h1:92UTHpy8CDwaJ08GqLDzhhuixiBUUD1p3AU6PHddz4A=
github.com/matryer/is v1.2.0/go.mod h1:2fLPjFQM9rhQ15aVEtbuwhJinnOqrmgXPNdZsdwlWXA=
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
github.com/mattn/go-colorable v0.1.4 h1:snbPLB8fVfU9iwbbo30TPtbLRzwWu6aJS6Xh4eaaviA=
Expand Down Expand Up @@ -275,7 +271,6 @@ github.com/nsf/jsondiff v0.0.0-20200515183724-f29ed568f4ce/go.mod h1:uFMI8w+ref4
github.com/oklog/run v1.0.0 h1:Ru7dDtJNOyC66gQ5dQmaCa0qIsAUFY3sFpK1Xk8igrw=
github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
Expand Down Expand Up @@ -330,8 +325,9 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh
golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 h1:/UOmuWzQfxxo9UtlXMwuQU8CMgg1eZXqTRwkSQJWKOI=
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 h1:7I4JAnoQBe7ZtJcBaYHi5UtiO8tQHbUSXxL+pnGRANg=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
Expand Down Expand Up @@ -587,7 +583,6 @@ gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME=
gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
Expand Down
2 changes: 2 additions & 0 deletions junos/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package junos
const (
idSeparator = "_-_"
defaultWord = "default"
evpnWord = "evpn"
inetWord = "inet"
inet6Word = "inet6"
mplsWord = "mpls"
Expand All @@ -11,6 +12,7 @@ const (
permitWord = "permit"
thenWord = "then"
prefixWord = "prefix"
prefixNameWord = "prefix-name"
actionNoneWord = "none"
addWord = "add"
deleteWord = "delete"
Expand Down
7 changes: 4 additions & 3 deletions junos/data_source_interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
balt "github.com/jeremmfr/go-utils/basicalter"
)

func dataSourceInterface() *schema.Resource {
Expand Down Expand Up @@ -388,11 +389,11 @@ func searchInterfaceID(configInterface string, match string,
m interface{}, jnprSess *NetconfObject) (string, error) {
sess := m.(*Session)
intConfigList := make([]string, 0)
intConfig, err := sess.command("show configuration interfaces "+configInterface+" | display set", jnprSess)
showConfig, err := sess.command("show configuration interfaces "+configInterface+" | display set", jnprSess)
if err != nil {
return "", err
}
for _, item := range strings.Split(intConfig, "\n") {
for _, item := range strings.Split(showConfig, "\n") {
if strings.Contains(item, "<configuration-output>") {
continue
}
Expand Down Expand Up @@ -424,7 +425,7 @@ func searchInterfaceID(configInterface string, match string,
}
}
}
intConfigList = uniqueListString(intConfigList)
intConfigList = balt.UniqueStrings(intConfigList)
if len(intConfigList) == 0 {
return "", nil
}
Expand Down
10 changes: 6 additions & 4 deletions junos/data_source_interface_logical.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import (

"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
balt "github.com/jeremmfr/go-utils/basicalter"
bchk "github.com/jeremmfr/go-utils/basiccheck"
)

func dataSourceInterfaceLogical() *schema.Resource {
Expand Down Expand Up @@ -409,11 +411,11 @@ func searchInterfaceLogicalID(configInterface string, match string,
m interface{}, jnprSess *NetconfObject) (string, error) {
sess := m.(*Session)
intConfigList := make([]string, 0)
intConfig, err := sess.command("show configuration interfaces "+configInterface+" | display set", jnprSess)
showConfig, err := sess.command("show configuration interfaces "+configInterface+" | display set", jnprSess)
if err != nil {
return "", err
}
for _, item := range strings.Split(intConfig, "\n") {
for _, item := range strings.Split(showConfig, "\n") {
if strings.Contains(item, "<configuration-output>") {
continue
}
Expand All @@ -436,12 +438,12 @@ func searchInterfaceLogicalID(configInterface string, match string,
case 0, 1, 2:
continue
default:
if itemTrimSplit[1] == "unit" && !stringInSlice("ethernet-switching", itemTrimSplit) {
if itemTrimSplit[1] == "unit" && !bchk.StringInSlice("ethernet-switching", itemTrimSplit) {
intConfigList = append(intConfigList, itemTrimSplit[0]+"."+itemTrimSplit[2])
}
}
}
intConfigList = uniqueListString(intConfigList)
intConfigList = balt.UniqueStrings(intConfigList)
if len(intConfigList) == 0 {
return "", nil
}
Expand Down
7 changes: 4 additions & 3 deletions junos/data_source_interface_physical.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
balt "github.com/jeremmfr/go-utils/basicalter"
)

func dataSourceInterfacePhysical() *schema.Resource {
Expand Down Expand Up @@ -373,11 +374,11 @@ func searchInterfacePhysicalID(configInterface string, match string,
m interface{}, jnprSess *NetconfObject) (string, error) {
sess := m.(*Session)
intConfigList := make([]string, 0)
intConfig, err := sess.command("show configuration interfaces "+configInterface+" | display set", jnprSess)
showConfig, err := sess.command("show configuration interfaces "+configInterface+" | display set", jnprSess)
if err != nil {
return "", err
}
for _, item := range strings.Split(intConfig, "\n") {
for _, item := range strings.Split(showConfig, "\n") {
if strings.Contains(item, "<configuration-output>") {
continue
}
Expand All @@ -401,7 +402,7 @@ func searchInterfacePhysicalID(configInterface string, match string,
}
intConfigList = append(intConfigList, itemTrimSplit[0])
}
intConfigList = uniqueListString(intConfigList)
intConfigList = balt.UniqueStrings(intConfigList)
if len(intConfigList) == 0 {
return "", nil
}
Expand Down
Loading

0 comments on commit 5a8d419

Please sign in to comment.