Skip to content

Commit

Permalink
docs: Small changes for the current PR
Browse files Browse the repository at this point in the history
  • Loading branch information
vaerh committed Jun 27, 2024
1 parent 85707d2 commit cb5ad50
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 35 deletions.
32 changes: 0 additions & 32 deletions examples/data-sources/routeros_firewall/data-source.tf

This file was deleted.

32 changes: 32 additions & 0 deletions examples/data-sources/routeros_ip_firewall/data-source.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
data "routeros_ip_firewall" "fw" {
rules {
filter = {
chain = "input"
comment = "rule_2"
}
}

rules {
filter = {
chain = "forward"
}
}

nat {}
}

output "rules" {
value = [for value in data.routeros_ip_firewall.fw.rules: [value.id, value.src_address]]
}

output "nat" {
value = [for value in data.routeros_ip_firewall.fw.nat: [value.id, value.comment]]
}

resource "routeros_ip_firewall" "rule_3" {
action = "accept"
chain = "input"
comment = "rule_3"
src_address = "192.168.0.5"
place_before = "${data.routeros_ip_firewall_filter.fw.rules[0].id}"
}
6 changes: 3 additions & 3 deletions routeros/datasource_ip_firewall.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

var ipfirewallSections = []string{"address_list", "nat", "mangle", "rules"}
var ipFirewallSections = []string{"address_list", "nat", "mangle", "rules"}

func DatasourceIPFirewall() *schema.Resource {
return &schema.Resource{
Expand All @@ -34,7 +34,7 @@ func datasourceIPFirewallFilterRead(ctx context.Context, d *schema.ResourceData,
s := DatasourceIPFirewall().Schema

var isEmpty = true
for _, section := range ipfirewallSections {
for _, section := range ipFirewallSections {
isEmpty = isEmpty && len(d.Get(section).([]interface{})) == 0
}

Expand All @@ -49,7 +49,7 @@ func datasourceIPFirewallFilterRead(ctx context.Context, d *schema.ResourceData,
}
}

for _, section := range ipfirewallSections {
for _, section := range ipFirewallSections {
if len(d.Get(section).([]interface{})) == 0 {
continue
}
Expand Down
5 changes: 5 additions & 0 deletions templates/data-sources/firewall.md.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# {{.Name}} ({{.Type}})
---

#### This is an alias for backwards compatibility between plugin versions.
Please see documentation for [routeros_ip_firewall](ip_firewall.md)

0 comments on commit cb5ad50

Please sign in to comment.