Skip to content

Commit

Permalink
init/updateFortiOSTerraform: 1.19.1
Browse files Browse the repository at this point in the history
Signed-off-by: FTNT-HQCM <[email protected]>
  • Loading branch information
FTNT-HQCM committed Apr 29, 2024
1 parent 7579286 commit ae77e25
Show file tree
Hide file tree
Showing 1,021 changed files with 19,941 additions and 1,751 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
## 1.20.0 (Unreleased)


## 1.19.1 (Apr 29, 2024)
BUG FIXES:

* Fix issue of merged argument element contains comma;
* Fix length limitation issue of merged argument;
* Fix issue of vdomparam cause force replacement even using the same vdom value;
* Fix data type error of API return empty string for integer data type;

IMPROVEMENTS:

* Support FortiOS version 6.4.15, 7.0.14, 7.0.15, 7.2.7, 7.2.8, 7.4.3;
* Update version check functionality;

FEATURES:

* **New Data source:** `fortios_system_license_fortiflex`

## 1.19.0 (Jan 29, 2024)
BUG FIXES:

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Terraform Provider
# FortiOS Terraform Provider

- Website: https://www.terraform.io
- [![Gitter chat](https://badges.gitter.im/hashicorp-terraform/Lobby.png)](https://gitter.im/hashicorp-terraform/Lobby)
- Mailing list: [Google Groups](http://groups.google.com/group/terraform-tool)

<img src="https://cdn.rawgit.com/hashicorp/terraform-website/master/content/source/assets/images/logo-hashicorp.svg" width="600px">
<img src="https://www.datocms-assets.com/2885/1629941242-logo-terraform-main.svg" width="600px">

## Requirements

Expand Down
3 changes: 2 additions & 1 deletion fortios/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"crypto/x509"
"fmt"
"io/ioutil"
"log"
"net/http"
"net/url"
"os"
Expand Down Expand Up @@ -274,7 +275,7 @@ func createFortiOSClient(fClient *FortiClient, c *Config) error {

err = fc.UpdateDeviceVersion()
if err != nil {
return fmt.Errorf("Can not update device version: %v", err)
log.Printf("[Warning] Can not update device version: %v", err)
}

fClient.Client = fc
Expand Down
23 changes: 16 additions & 7 deletions fortios/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"net"
"net/url"
"os"
"reflect"
"regexp"
"sort"
"strconv"
Expand Down Expand Up @@ -179,17 +180,17 @@ func convintflist2str(v interface{}) interface{} {
return res
}

func i2ss2arrFortiAPIUpgrade(v string, new_version_map map[string][]string) bool {
func checkVersionMatch(v string, new_version_map map[string][]string) (bool, error) {
v1, err := version.NewVersion(v)
if err != nil {
return false
return false, err
}

for operator, version_list := range new_version_map {
if operator == "=" {
for _, cur_version := range version_list {
if cur_version == v {
return true
return true, nil
}
}
} else if operator == ">=" {
Expand All @@ -198,20 +199,24 @@ func i2ss2arrFortiAPIUpgrade(v string, new_version_map map[string][]string) bool
continue
}
if v1.GreaterThanOrEqual(min_version) {
return true
return true, nil
}
} else if operator == "<=" {
max_version, err := version.NewVersion(version_list[0])
if err != nil {
continue
}
if v1.LessThanOrEqual(max_version) {
return true
return true, nil
}
}
}

return false
var supported_version_list []string
for operator, version_list := range new_version_map {
supported_version_list = append(supported_version_list, operator+strings.Join(version_list, ","))
}
err = fmt.Errorf("requires FortiOS version: %s, your device version is: %s.", strings.Join(supported_version_list, ""), v)
return false, err
}

func intBetweenWithZero(min, max int) schema.SchemaValidateFunc {
Expand Down Expand Up @@ -250,3 +255,7 @@ func remove_quote(v interface{}) interface{} {
}
return v
}

func bZero(v interface{}) bool {
return reflect.ValueOf(v).IsZero()
}
4 changes: 2 additions & 2 deletions fortios/data_source_router_bgp.go
Original file line number Diff line number Diff line change
Expand Up @@ -2004,7 +2004,7 @@ func dataSourceRouterBgpRead(d *schema.ResourceData, m interface{}) error {
return nil
}

func dataSourceFlattenRouterBgpAs_String(v interface{}, d *schema.ResourceData, pre string) interface{} {
func dataSourceFlattenRouterBgpAsString(v interface{}, d *schema.ResourceData, pre string) interface{} {
return v
}

Expand Down Expand Up @@ -6418,7 +6418,7 @@ func dataSourceFlattenRouterBgpVrfLeak6TargetInterface(v interface{}, d *schema.
func dataSourceRefreshObjectRouterBgp(d *schema.ResourceData, o map[string]interface{}) error {
var err error

if err = d.Set("as_string", dataSourceFlattenRouterBgpAs_String(o["as"], d, "as_string")); err != nil {
if err = d.Set("as_string", dataSourceFlattenRouterBgpAsString(o["as"], d, "as_string")); err != nil {
if !fortiAPIPatch(o["as"]) {
return fmt.Errorf("Error reading as_string: %v", err)
}
Expand Down
Loading

0 comments on commit ae77e25

Please sign in to comment.