Skip to content

Commit

Permalink
init/updateFortiOSTerraform: 1.21.0
Browse files Browse the repository at this point in the history
Signed-off-by: FTNT-HQCM <[email protected]>
  • Loading branch information
FTNT-HQCM committed Nov 1, 2024
1 parent 03ccd37 commit ffb14d1
Show file tree
Hide file tree
Showing 173 changed files with 972 additions and 482 deletions.
17 changes: 16 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
## 1.22.0 (Unreleased)


## 1.21.0 (Sep 12, 2024)
## 1.21.1 (Nov 1, 2024)
BUG FIXES:

* Fix destroy issue of resource system_ftmpush;
* Fix issue of timezone could not been unset of resource system_global;
* Fix auto-generated id always show changes issue;
* Fix ip format issue;
* Fix error of set zero value of resource system_interface;
* Fix token issue of 7.4.5;

IMPROVEMENTS:

* Support FortiOS version 7.2.10, 7.4.5;


## 1.21.0 (Sep 13, 2024)
BUG FIXES:

* Fix global scope issue;
Expand Down
28 changes: 28 additions & 0 deletions fortios/data_source_firewall_address6.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,14 @@ func dataSourceFirewallAddress6() *schema.Resource {
Type: schema.TypeString,
Computed: true,
},
"filter": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},
"sdn_addr_type": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},
"fabric_object": &schema.Schema{
Type: schema.TypeString,
Computed: true,
Expand Down Expand Up @@ -547,6 +555,14 @@ func dataSourceFlattenFirewallAddress6SdnTag(v interface{}, d *schema.ResourceDa
return v
}

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

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

func dataSourceFlattenFirewallAddress6FabricObject(v interface{}, d *schema.ResourceData, pre string) interface{} {
return v
}
Expand Down Expand Up @@ -716,6 +732,18 @@ func dataSourceRefreshObjectFirewallAddress6(d *schema.ResourceData, o map[strin
}
}

if err = d.Set("filter", dataSourceFlattenFirewallAddress6Filter(o["filter"], d, "filter")); err != nil {
if !fortiAPIPatch(o["filter"]) {
return fmt.Errorf("Error reading filter: %v", err)
}
}

if err = d.Set("sdn_addr_type", dataSourceFlattenFirewallAddress6SdnAddrType(o["sdn-addr-type"], d, "sdn_addr_type")); err != nil {
if !fortiAPIPatch(o["sdn-addr-type"]) {
return fmt.Errorf("Error reading sdn_addr_type: %v", err)
}
}

if err = d.Set("fabric_object", dataSourceFlattenFirewallAddress6FabricObject(o["fabric-object"], d, "fabric_object")); err != nil {
if !fortiAPIPatch(o["fabric-object"]) {
return fmt.Errorf("Error reading fabric_object: %v", err)
Expand Down
21 changes: 21 additions & 0 deletions fortios/data_source_system_global.go
Original file line number Diff line number Diff line change
Expand Up @@ -973,6 +973,10 @@ func dataSourceSystemGlobal() *schema.Resource {
Type: schema.TypeString,
Computed: true,
},
"rest_api_key_url_query": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},
"gui_cdn_domain_override": &schema.Schema{
Type: schema.TypeString,
Computed: true,
Expand Down Expand Up @@ -2004,6 +2008,13 @@ func dataSourceFlattenSystemGlobalFortiextender(v interface{}, d *schema.Resourc
}

func dataSourceFlattenSystemGlobalExtenderControllerReservedNetwork(v interface{}, d *schema.ResourceData, pre string) interface{} {
if v1, ok := d.GetOkExists(pre); ok && v != nil {
if s, ok := v1.(string); ok {
v = validateConvIPMask2CIDR(s, v.(string))
return v
}
}

return v
}

Expand Down Expand Up @@ -2222,6 +2233,10 @@ func dataSourceFlattenSystemGlobalGuiRestApiCache(v interface{}, d *schema.Resou
return v
}

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

func dataSourceFlattenSystemGlobalGuiCdnDomainOverride(v interface{}, d *schema.ResourceData, pre string) interface{} {
return v
}
Expand Down Expand Up @@ -3919,6 +3934,12 @@ func dataSourceRefreshObjectSystemGlobal(d *schema.ResourceData, o map[string]in
}
}

if err = d.Set("rest_api_key_url_query", dataSourceFlattenSystemGlobalRestApiKeyUrlQuery(o["rest-api-key-url-query"], d, "rest_api_key_url_query")); err != nil {
if !fortiAPIPatch(o["rest-api-key-url-query"]) {
return fmt.Errorf("Error reading rest_api_key_url_query: %v", err)
}
}

if err = d.Set("gui_cdn_domain_override", dataSourceFlattenSystemGlobalGuiCdnDomainOverride(o["gui-cdn-domain-override"], d, "gui_cdn_domain_override")); err != nil {
if !fortiAPIPatch(o["gui-cdn-domain-override"]) {
return fmt.Errorf("Error reading gui_cdn_domain_override: %v", err)
Expand Down
21 changes: 21 additions & 0 deletions fortios/data_source_system_interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -1773,6 +1773,13 @@ func dataSourceFlattenSystemInterfaceDhcpClasslessRouteAddition(v interface{}, d
}

func dataSourceFlattenSystemInterfaceManagementIp(v interface{}, d *schema.ResourceData, pre string) interface{} {
if v1, ok := d.GetOkExists(pre); ok && v != nil {
if s, ok := v1.(string); ok {
v = validateConvIPMask2CIDR(s, v.(string))
return v
}
}

return v
}

Expand Down Expand Up @@ -2257,6 +2264,13 @@ func dataSourceFlattenSystemInterfaceForwardDomain(v interface{}, d *schema.Reso
}

func dataSourceFlattenSystemInterfaceRemoteIp(v interface{}, d *schema.ResourceData, pre string) interface{} {
if v1, ok := d.GetOkExists(pre); ok && v != nil {
if s, ok := v1.(string); ok {
v = validateConvIPMask2CIDR(s, v.(string))
return v
}
}

return v
}

Expand Down Expand Up @@ -2855,6 +2869,13 @@ func dataSourceFlattenSystemInterfaceSecondaryipId(v interface{}, d *schema.Reso
}

func dataSourceFlattenSystemInterfaceSecondaryipIp(v interface{}, d *schema.ResourceData, pre string) interface{} {
if v1, ok := d.GetOkExists(pre); ok && v != nil {
if s, ok := v1.(string); ok {
v = validateConvIPMask2CIDR(s, v.(string))
return v
}
}

return v
}

Expand Down
26 changes: 26 additions & 0 deletions fortios/data_source_system_sdnconnector.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,10 @@ func dataSourceSystemSdnConnector() *schema.Resource {
Type: schema.TypeString,
Computed: true,
},
"peer_nic": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},
"ip": &schema.Schema{
Type: schema.TypeList,
Computed: true,
Expand All @@ -195,6 +199,10 @@ func dataSourceSystemSdnConnector() *schema.Resource {
Type: schema.TypeString,
Computed: true,
},
"private_ip": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},
"public_ip": &schema.Schema{
Type: schema.TypeString,
Computed: true,
Expand Down Expand Up @@ -722,6 +730,11 @@ func dataSourceFlattenSystemSdnConnectorNic(v interface{}, d *schema.ResourceDat
tmp["name"] = dataSourceFlattenSystemSdnConnectorNicName(i["name"], d, pre_append)
}

pre_append = pre + "." + strconv.Itoa(con) + "." + "peer_nic"
if _, ok := i["peer-nic"]; ok {
tmp["peer_nic"] = dataSourceFlattenSystemSdnConnectorNicPeerNic(i["peer-nic"], d, pre_append)
}

pre_append = pre + "." + strconv.Itoa(con) + "." + "ip"
if _, ok := i["ip"]; ok {
tmp["ip"] = dataSourceFlattenSystemSdnConnectorNicIp(i["ip"], d, pre_append)
Expand All @@ -739,6 +752,10 @@ func dataSourceFlattenSystemSdnConnectorNicName(v interface{}, d *schema.Resourc
return v
}

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

func dataSourceFlattenSystemSdnConnectorNicIp(v interface{}, d *schema.ResourceData, pre string) []map[string]interface{} {
if v == nil {
return nil
Expand All @@ -763,6 +780,11 @@ func dataSourceFlattenSystemSdnConnectorNicIp(v interface{}, d *schema.ResourceD
tmp["name"] = dataSourceFlattenSystemSdnConnectorNicIpName(i["name"], d, pre_append)
}

pre_append = pre + "." + strconv.Itoa(con) + "." + "private_ip"
if _, ok := i["private-ip"]; ok {
tmp["private_ip"] = dataSourceFlattenSystemSdnConnectorNicIpPrivateIp(i["private-ip"], d, pre_append)
}

pre_append = pre + "." + strconv.Itoa(con) + "." + "public_ip"
if _, ok := i["public-ip"]; ok {
tmp["public_ip"] = dataSourceFlattenSystemSdnConnectorNicIpPublicIp(i["public-ip"], d, pre_append)
Expand All @@ -785,6 +807,10 @@ func dataSourceFlattenSystemSdnConnectorNicIpName(v interface{}, d *schema.Resou
return v
}

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

func dataSourceFlattenSystemSdnConnectorNicIpPublicIp(v interface{}, d *schema.ResourceData, pre string) interface{} {
return v
}
Expand Down
9 changes: 3 additions & 6 deletions fortios/resource_application_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ func resourceApplicationList() *schema.Resource {
"id": &schema.Schema{
Type: schema.TypeInt,
Optional: true,
Computed: true,
},
"risk": &schema.Schema{
Type: schema.TypeSet,
Expand Down Expand Up @@ -212,6 +213,7 @@ func resourceApplicationList() *schema.Resource {
"id": &schema.Schema{
Type: schema.TypeInt,
Optional: true,
Computed: true,
},
"members": &schema.Schema{
Type: schema.TypeList,
Expand All @@ -221,6 +223,7 @@ func resourceApplicationList() *schema.Resource {
"id": &schema.Schema{
Type: schema.TypeInt,
Optional: true,
Computed: true,
},
"name": &schema.Schema{
Type: schema.TypeString,
Expand Down Expand Up @@ -1437,8 +1440,6 @@ func expandApplicationListEntries(d *schema.ResourceData, v interface{}, pre str
pre_append = pre + "." + strconv.Itoa(con) + "." + "id"
if _, ok := d.GetOk(pre_append); ok {
tmp["id"], _ = expandApplicationListEntriesId(d, i["id"], pre_append, sv)
} else if d.HasChange(pre_append) {
tmp["id"] = nil
}

pre_append = pre + "." + strconv.Itoa(con) + "." + "risk"
Expand Down Expand Up @@ -1777,8 +1778,6 @@ func expandApplicationListEntriesParameters(d *schema.ResourceData, v interface{
pre_append = pre + "." + strconv.Itoa(con) + "." + "id"
if _, ok := d.GetOk(pre_append); ok {
tmp["id"], _ = expandApplicationListEntriesParametersId(d, i["id"], pre_append, sv)
} else if d.HasChange(pre_append) {
tmp["id"] = nil
}

pre_append = pre + "." + strconv.Itoa(con) + "." + "members"
Expand Down Expand Up @@ -1824,8 +1823,6 @@ func expandApplicationListEntriesParametersMembers(d *schema.ResourceData, v int
pre_append = pre + "." + strconv.Itoa(con) + "." + "id"
if _, ok := d.GetOk(pre_append); ok {
tmp["id"], _ = expandApplicationListEntriesParametersMembersId(d, i["id"], pre_append, sv)
} else if d.HasChange(pre_append) {
tmp["id"] = nil
}

pre_append = pre + "." + strconv.Itoa(con) + "." + "name"
Expand Down
3 changes: 1 addition & 2 deletions fortios/resource_application_name.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ func resourceApplicationName() *schema.Resource {
"id": &schema.Schema{
Type: schema.TypeInt,
Optional: true,
Computed: true,
},
"metaid": &schema.Schema{
Type: schema.TypeInt,
Expand Down Expand Up @@ -664,8 +665,6 @@ func expandApplicationNameMetadata(d *schema.ResourceData, v interface{}, pre st
pre_append = pre + "." + strconv.Itoa(con) + "." + "id"
if _, ok := d.GetOk(pre_append); ok {
tmp["id"], _ = expandApplicationNameMetadataId(d, i["id"], pre_append, sv)
} else if d.HasChange(pre_append) {
tmp["id"] = nil
}

pre_append = pre + "." + strconv.Itoa(con) + "." + "metaid"
Expand Down
3 changes: 1 addition & 2 deletions fortios/resource_application_rulesettings.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ func resourceApplicationRuleSettings() *schema.Resource {
"fosid": &schema.Schema{
Type: schema.TypeInt,
Optional: true,
Computed: true,
},
},
}
Expand Down Expand Up @@ -231,8 +232,6 @@ func getObjectApplicationRuleSettings(d *schema.ResourceData, sv string) (*map[s
} else if t != nil {
obj["id"] = t
}
} else if d.HasChange("fosid") {
obj["id"] = nil
}

return &obj, nil
Expand Down
6 changes: 2 additions & 4 deletions fortios/resource_casb_useractivity.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ func resourceCasbUserActivity() *schema.Resource {
"id": &schema.Schema{
Type: schema.TypeInt,
Optional: true,
Computed: true,
},
"strategy": &schema.Schema{
Type: schema.TypeString,
Expand All @@ -105,6 +106,7 @@ func resourceCasbUserActivity() *schema.Resource {
"id": &schema.Schema{
Type: schema.TypeInt,
Optional: true,
Computed: true,
},
"type": &schema.Schema{
Type: schema.TypeString,
Expand Down Expand Up @@ -1073,8 +1075,6 @@ func expandCasbUserActivityMatch(d *schema.ResourceData, v interface{}, pre stri
pre_append = pre + "." + strconv.Itoa(con) + "." + "id"
if _, ok := d.GetOk(pre_append); ok {
tmp["id"], _ = expandCasbUserActivityMatchId(d, i["id"], pre_append, sv)
} else if d.HasChange(pre_append) {
tmp["id"] = nil
}

pre_append = pre + "." + strconv.Itoa(con) + "." + "strategy"
Expand Down Expand Up @@ -1122,8 +1122,6 @@ func expandCasbUserActivityMatchRules(d *schema.ResourceData, v interface{}, pre
pre_append = pre + "." + strconv.Itoa(con) + "." + "id"
if _, ok := d.GetOk(pre_append); ok {
tmp["id"], _ = expandCasbUserActivityMatchRulesId(d, i["id"], pre_append, sv)
} else if d.HasChange(pre_append) {
tmp["id"] = nil
}

pre_append = pre + "." + strconv.Itoa(con) + "." + "type"
Expand Down
3 changes: 1 addition & 2 deletions fortios/resource_dlp_dictionary.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ func resourceDlpDictionary() *schema.Resource {
"id": &schema.Schema{
Type: schema.TypeInt,
Optional: true,
Computed: true,
},
"type": &schema.Schema{
Type: schema.TypeString,
Expand Down Expand Up @@ -487,8 +488,6 @@ func expandDlpDictionaryEntries(d *schema.ResourceData, v interface{}, pre strin
pre_append = pre + "." + strconv.Itoa(con) + "." + "id"
if _, ok := d.GetOk(pre_append); ok {
tmp["id"], _ = expandDlpDictionaryEntriesId(d, i["id"], pre_append, sv)
} else if d.HasChange(pre_append) {
tmp["id"] = nil
}

pre_append = pre + "." + strconv.Itoa(con) + "." + "type"
Expand Down
3 changes: 1 addition & 2 deletions fortios/resource_dlp_profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ func resourceDlpProfile() *schema.Resource {
"id": &schema.Schema{
Type: schema.TypeInt,
Optional: true,
Computed: true,
},
"name": &schema.Schema{
Type: schema.TypeString,
Expand Down Expand Up @@ -743,8 +744,6 @@ func expandDlpProfileRule(d *schema.ResourceData, v interface{}, pre string, sv
pre_append = pre + "." + strconv.Itoa(con) + "." + "id"
if _, ok := d.GetOk(pre_append); ok {
tmp["id"], _ = expandDlpProfileRuleId(d, i["id"], pre_append, sv)
} else if d.HasChange(pre_append) {
tmp["id"] = nil
}

pre_append = pre + "." + strconv.Itoa(con) + "." + "name"
Expand Down
Loading

0 comments on commit ffb14d1

Please sign in to comment.