diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 77a3da66..7586c102 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -1,14 +1,14 @@ name: Go Tests on: [push, pull_request] jobs: - build-1_18: - name: Build 1.18 + build-1_19: + name: Build 1.19 runs-on: ubuntu-latest steps: - - name: Set up Go 1.18 + - name: Set up Go 1.19 uses: actions/setup-go@v3 with: - go-version: 1.18 + go-version: '1.19' check-latest: true id: go - name: Disable cgo @@ -21,14 +21,14 @@ jobs: - name: Build run: go build -v . - build-1_19: - name: Build 1.19 + build-1_20: + name: Build 1.20 runs-on: ubuntu-latest steps: - - name: Set up Go 1.19 + - name: Set up Go 1.20 uses: actions/setup-go@v3 with: - go-version: 1.19 + go-version: '1.20' check-latest: true id: go - name: Disable cgo @@ -45,10 +45,10 @@ jobs: name: Test runs-on: ubuntu-latest steps: - - name: Set up Go 1.19 + - name: Set up Go 1.20 uses: actions/setup-go@v3 with: - go-version: 1.19 + go-version: '1.20' check-latest: true id: go - name: Disable cgo diff --git a/.github/workflows/go_analysis.yml b/.github/workflows/go_analysis.yml index 0eb23165..938485af 100644 --- a/.github/workflows/go_analysis.yml +++ b/.github/workflows/go_analysis.yml @@ -14,9 +14,9 @@ jobs: steps: - uses: actions/checkout@v3 - name: Running govulncheck - uses: Templum/govulncheck-action@v0.0.8 + uses: Templum/govulncheck-action@v0.0.9 with: - go-version: 1.19 + go-version: '1.20' vulncheck-version: latest package: ./... fail-on-vuln: false diff --git a/.github/workflows/linters-main.yml b/.github/workflows/linters-main.yml index 9d941b5c..e1394a96 100644 --- a/.github/workflows/linters-main.yml +++ b/.github/workflows/linters-main.yml @@ -8,10 +8,10 @@ jobs: name: golangci-lint-latest runs-on: ubuntu-latest steps: - - name: Set up Go 1.19 + - name: Set up Go 1.20 uses: actions/setup-go@v3 with: - go-version: 1.19 + go-version: '1.20' check-latest: true id: go - name: Disable cgo diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml index e70935bb..2bc0be87 100644 --- a/.github/workflows/linters.yml +++ b/.github/workflows/linters.yml @@ -5,10 +5,10 @@ jobs: name: golangci-lint runs-on: ubuntu-latest steps: - - name: Set up Go 1.19 + - name: Set up Go 1.20 uses: actions/setup-go@v3 with: - go-version: 1.19 + go-version: '1.20' check-latest: true id: go - name: Disable cgo @@ -19,7 +19,7 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@v3 with: - version: v1.50 + version: v1.51 args: -c .golangci.yml -v markdown-lint: @@ -38,10 +38,10 @@ jobs: name: terrafmt runs-on: ubuntu-latest steps: - - name: Set up Go 1.19 + - name: Set up Go 1.20 uses: actions/setup-go@v3 with: - go-version: 1.19 + go-version: '1.20' check-latest: true id: go - name: Show version @@ -71,28 +71,3 @@ jobs: echo "terraform blocks in website/test-go files not being properly formatted" exit 1 fi - # see https://github.com/bflad/tfproviderlint/issues/255 - # tfproviderlint: - # name: tfproviderlint - # runs-on: ubuntu-latest - # steps: - # - name: Set up Go 1.18 - # uses: actions/setup-go@v3 - # with: - # go-version: 1.18 - # check-latest: true - # id: go - # - name: Show version - # run: go version - # - name: Check out code - # uses: actions/checkout@v3 - # - name: Check out tfproviderlint code - # uses: actions/checkout@v3 - # with: - # repository: bflad/tfproviderlint - # ref: v0.28.1 - # path: tfproviderlint - # - name: Build tfproviderlint bin - # run: cd tfproviderlint && go install ./... && cd ${GITHUB_WORKSPACE} - # - name: Run tfproviderlint - # run: tfproviderlint -AT001=false -AT006=false -R007=false -R009=false -R014=false -R018=false ./... diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index d1335b8d..b721d113 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -38,10 +38,10 @@ jobs: - goos: windows goarch: arm64 steps: - - name: Set up Go 1.19 + - name: Set up Go 1.20 uses: actions/setup-go@v3 with: - go-version: ^1.19.2 + go-version: '^1.20.0' check-latest: true id: go - name: Show version diff --git a/.golangci.yml b/.golangci.yml index 3adc6eda..10e76a3f 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -29,6 +29,7 @@ linters: - maintidx - execinquery - nosnakecase + - musttag linters-settings: gocognit: # minimal code complexity to report, 30 by default diff --git a/CHANGELOG.md b/CHANGELOG.md index bb4f301e..580dc089 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,14 @@ ENHANCEMENTS: BUG FIXES: +## 1.33.0 (February 07, 2023) + +ENHANCEMENTS: + +* resource/`junos_interface_physical`: add `mtu` argument (Fixes [#451](https://github.com/jeremmfr/terraform-provider-junos/issues/451)) +* data-source/`junos_interface_physical`: add `mtu` attribute (like resource) +* release now with golang 1.20 + ## 1.32.0 (December 22, 2022) ENHANCEMENTS: diff --git a/README.md b/README.md index a23b15d2..ffd5ce04 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ for provider and resources documentation. ### In addition to develop -- [Go](https://golang.org/doc/install) `v1.18` or `v1.19` +- [Go](https://golang.org/doc/install) `v1.19` or `v1.20` ## Automatic install (Terraform 0.13 and later) diff --git a/docs/data-sources/interface_physical.md b/docs/data-sources/interface_physical.md index 7b36b2e1..b09b3b37 100644 --- a/docs/data-sources/interface_physical.md +++ b/docs/data-sources/interface_physical.md @@ -87,6 +87,8 @@ The following attributes are exported: Don't enable loopback. - **redundant_parent** (String) Name of a redundant ethernet interface to join. +- **mtu** (Optional, Number) + Maximum transmission unit. - **parent_ether_opts** (Block) The `aggregated-ether-options` or `redundant-ether-options` configuration (it depends on the interface `name`). diff --git a/docs/resources/interface_physical.md b/docs/resources/interface_physical.md index d1ef930a..b55b3882 100644 --- a/docs/resources/interface_physical.md +++ b/docs/resources/interface_physical.md @@ -95,6 +95,8 @@ The following arguments are supported: Don't enable loopback. - **redundant_parent** (Optional, String) Name of a redundant ethernet interface to join. +- **mtu** (Optional, Number) + Maximum transmission unit. - **parent_ether_opts** (Optional, Block) Declare `aggregated-ether-options` or `redundant-ether-options` configuration (it depends on the interface `name`). diff --git a/docs/resources/security_address_book.md b/docs/resources/security_address_book.md index faf84a9d..3fab247d 100644 --- a/docs/resources/security_address_book.md +++ b/docs/resources/security_address_book.md @@ -70,7 +70,7 @@ The following arguments are supported: - **value** (Required, String) Network and mask of wildcard address (`192.0.0.0/255.255.0.255`). - **description** (Optional, String) - Description of network address. + Description of wildcard address. - **dns_name** (Optional, Block Set) For each name of dns name address. - **name** (Required, String) diff --git a/go.mod b/go.mod index 4d043516..d79f8eac 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/jeremmfr/terraform-provider-junos -go 1.18 +go 1.19 require ( github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 diff --git a/junos/data_source_interface_physical.go b/junos/data_source_interface_physical.go index f2db7527..c0f4283f 100644 --- a/junos/data_source_interface_physical.go +++ b/junos/data_source_interface_physical.go @@ -172,6 +172,10 @@ func dataSourceInterfacePhysical() *schema.Resource { }, }, }, + "mtu": { + Type: schema.TypeInt, + Computed: true, + }, "parent_ether_opts": { Type: schema.TypeList, Computed: true, diff --git a/junos/resource_interface_logical.go b/junos/resource_interface_logical.go index 16758af7..b58ede64 100644 --- a/junos/resource_interface_logical.go +++ b/junos/resource_interface_logical.go @@ -313,7 +313,7 @@ func resourceInterfaceLogical() *schema.Resource { "mtu": { Type: schema.TypeInt, Optional: true, - ValidateFunc: validation.IntBetween(500, 9192), + ValidateFunc: validation.IntBetween(1, 9500), }, "rpf_check": { Type: schema.TypeList, @@ -559,7 +559,7 @@ func resourceInterfaceLogical() *schema.Resource { "mtu": { Type: schema.TypeInt, Optional: true, - ValidateFunc: validation.IntBetween(500, 9192), + ValidateFunc: validation.IntBetween(1, 9500), }, "rpf_check": { Type: schema.TypeList, diff --git a/junos/resource_interface_physical.go b/junos/resource_interface_physical.go index d82a19ec..99e04e89 100644 --- a/junos/resource_interface_physical.go +++ b/junos/resource_interface_physical.go @@ -18,6 +18,7 @@ type interfacePhysicalOptions struct { trunk bool vlanTagging bool aeMinLink int + mtu int vlanNative int aeLacp string aeLinkSpeed string @@ -282,6 +283,11 @@ func resourceInterfacePhysical() *schema.Resource { }, }, }, + "mtu": { + Type: schema.TypeInt, + Optional: true, + ValidateFunc: validation.IntBetween(1, 9500), + }, "parent_ether_opts": { Type: schema.TypeList, Optional: true, @@ -1039,6 +1045,9 @@ func setInterfacePhysical(d *schema.ResourceData, clt *Client, junSess *junosSes configSet = append(configSet, "set chassis aggregated-devices ethernet device-count "+aggregatedCount) } } + if v := d.Get("mtu").(int); v != 0 { + configSet = append(configSet, setPrefix+"mtu "+strconv.Itoa(v)) + } for _, v := range d.Get("parent_ether_opts").([]interface{}) { if v == nil { return fmt.Errorf("parent_ether_opts block is empty") @@ -1262,6 +1271,11 @@ func readInterfacePhysical(interFace string, clt *Client, junSess *junosSession, confRead.readInterfacePhysicalEtherOpts(itemTrim) case balt.CutPrefixInString(&itemTrim, "gigether-options "): confRead.readInterfacePhysicalGigetherOpts(itemTrim) + case balt.CutPrefixInString(&itemTrim, "mtu "): + confRead.mtu, err = strconv.Atoi(itemTrim) + if err != nil { + return confRead, fmt.Errorf(failedConvAtoiError, itemTrim, err) + } case balt.CutPrefixInString(&itemTrim, "native-vlan-id "): confRead.vlanNative, err = strconv.Atoi(itemTrim) if err != nil { @@ -1714,6 +1728,9 @@ func fillInterfacePhysicalData(d *schema.ResourceData, interfaceOpt interfacePhy panic(tfErr) } } + if tfErr := d.Set("mtu", interfaceOpt.mtu); tfErr != nil { + panic(tfErr) + } if !okAeLacp && !okAeLinkSpeed && !okAeMinLinks { if tfErr := d.Set("parent_ether_opts", interfaceOpt.parentEtherOpts); tfErr != nil { panic(tfErr) diff --git a/junos/resource_interface_physical_test.go b/junos/resource_interface_physical_test.go index d0d5ac90..f2edfe62 100644 --- a/junos/resource_interface_physical_test.go +++ b/junos/resource_interface_physical_test.go @@ -269,6 +269,7 @@ resource "junos_interface_physical" "testacc_interface2" { loopback = true auto_negotiation = true } + mtu = 9000 } resource "junos_interface_logical" "testacc_interfaceLO" { name = "lo0.0" diff --git a/junos/resource_policyoptions_test.go b/junos/resource_policyoptions_test.go index 83622b40..d6e6c5d8 100644 --- a/junos/resource_policyoptions_test.go +++ b/junos/resource_policyoptions_test.go @@ -137,9 +137,9 @@ func TestAccJunosPolicyOptions_basic(t *testing.T) { resource.TestCheckResourceAttr("junos_policyoptions_policy_statement.testacc_policyOptions", "then.0.action", "accept"), resource.TestCheckResourceAttr("junos_policyoptions_policy_statement.testacc_policyOptions", - "then.0.as_path_expand", "65000 65000"), //nolint: dupword + "then.0.as_path_expand", "65000 65000"), resource.TestCheckResourceAttr("junos_policyoptions_policy_statement.testacc_policyOptions", - "then.0.as_path_prepend", "65000 65000"), //nolint: dupword + "then.0.as_path_prepend", "65000 65000"), resource.TestCheckResourceAttr("junos_policyoptions_policy_statement.testacc_policyOptions", "then.0.community.#", "3"), resource.TestCheckResourceAttr("junos_policyoptions_policy_statement.testacc_policyOptions", @@ -289,7 +289,7 @@ func TestAccJunosPolicyOptions_basic(t *testing.T) { resource.TestCheckResourceAttr("junos_policyoptions_policy_statement.testacc_policyOptions", "term.0.then.0.as_path_expand", "last-as count 1"), resource.TestCheckResourceAttr("junos_policyoptions_policy_statement.testacc_policyOptions", - "term.0.then.0.as_path_prepend", "65000 65000"), //nolint: dupword + "term.0.then.0.as_path_prepend", "65000 65000"), resource.TestCheckResourceAttr("junos_policyoptions_policy_statement.testacc_policyOptions", "term.0.then.0.community.#", "3"), resource.TestCheckResourceAttr("junos_policyoptions_policy_statement.testacc_policyOptions",