Skip to content

Commit

Permalink
fix: Resource firewall filter
Browse files Browse the repository at this point in the history
Fixes #237
  • Loading branch information
vaerh committed Jul 12, 2023
1 parent 1995d9e commit fa04b82
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
8 changes: 7 additions & 1 deletion routeros/resource_ip_firewall_filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,19 @@ func ResourceIPFirewallFilter() *schema.Resource {
"jump", "log", "passthrough", "reject", "return", "tarpit",
}, false),
},
"address_list": {
Type: schema.TypeString,
Optional: true,
Description: "Name of the address list used in 'add-dst-to-address-list' and 'add-src-to-address-list' actions.",
},
"address_list_timeout": {
Type: schema.TypeString,
Optional: true,
Default: "none-dynamic",
Description: "Time interval after which the address will be removed from the address list specified by " +
"address-list parameter. Used in conjunction with add-dst-to-address-list or add-src-to-address-list " +
"actions.",
DiffSuppressFunc: TimeEquall,
},
"bytes": {
Type: schema.TypeInt,
Expand Down Expand Up @@ -392,7 +398,7 @@ func ResourceIPFirewallFilter() *schema.Resource {
ReadContext: DefaultRead(resSchema),
UpdateContext: func(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
resSchema[MetaSkipFields].Default = `"place_before"`
defer func(){
defer func() {
resSchema[MetaSkipFields].Default = ``
}()

Expand Down
18 changes: 11 additions & 7 deletions routeros/resource_ip_firewall_filter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,24 @@ func testAccCheckIPFirewallFilterExists(name string) resource.TestCheckFunc {
}

func testAccIPFirewallFilterConfig() string {
return `
provider "routeros" {
insecure = true
}
return providerConfig + `
resource "routeros_firewall_filter" "rule" {
action = "accept"
chain = "forward"
src_address = "10.0.0.1"
dst_address = "10.0.1.1"
dst_port = "443"
protocol = "tcp"
}
}
resource "routeros_ip_firewall_filter" "testepeg" {
action = "add-dst-to-address-list"
address_list_timeout = "00:00:10"
protocol = "tcp"
tls_host = "globo"
address_list = "teste"
chain = "forward"
src_address_list = "LAN"
}
`
}

0 comments on commit fa04b82

Please sign in to comment.