Skip to content

Commit

Permalink
Support the configuration of the interfaces automatically created by …
Browse files Browse the repository at this point in the history
…FGT #97
  • Loading branch information
frankshen01 committed Oct 21, 2020
1 parent 015f98a commit 9d8546d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
22 changes: 16 additions & 6 deletions fortios/resource_system_interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ func resourceSystemInterface() *schema.Resource {
},

Schema: map[string]*schema.Schema{
"autogenerated": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"name": &schema.Schema{
Type: schema.TypeString,
ValidateFunc: validation.StringLenBetween(0, 15),
Expand Down Expand Up @@ -1498,7 +1503,8 @@ func resourceSystemInterfaceCreate(d *schema.ResourceData, m interface{}) error

var o map[string]interface{}
v, _ := d.GetOk("type")
if v == "physical" {
ag, _ := d.GetOk("autogenerated")
if v == "physical" || ag == "auto" {
o, err = c.UpdateSystemInterface(obj, (*obj)["name"].(string))
} else {
o, err = c.CreateSystemInterface(obj)
Expand Down Expand Up @@ -1549,11 +1555,15 @@ func resourceSystemInterfaceDelete(d *schema.ResourceData, m interface{}) error
c.Retries = 1

v, _ := d.GetOk("type")
if v != "physical" {
err := c.DeleteSystemInterface(mkey)
if err != nil {
return fmt.Errorf("Error deleting SystemInterface resource: %v", err)
}
ag, _ := d.GetOk("autogenerated")
if v == "physical" || ag == "auto" {
d.SetId("")
return nil
}

err := c.DeleteSystemInterface(mkey)
if err != nil {
return fmt.Errorf("Error deleting SystemInterface resource: %v", err)
}

d.SetId("")
Expand Down
1 change: 1 addition & 0 deletions website/docs/r/fortios_system_interface.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ The following arguments are supported:
* `color` - Color of icon on the GUI.
* `tagging` - Config object tagging.
* `ipv6` - IPv6 of interface.
* `autogenerated` - Indicates whether the interface is automatically created by FortiGate, for example, created during the VPN creation process. If it is, set it to "auto", else keep it empty.

The `fail_alert_interfaces` block supports:

Expand Down

0 comments on commit 9d8546d

Please sign in to comment.