Skip to content

Commit

Permalink
Merge pull request #614 from buengese/ipv6-nat
Browse files Browse the repository at this point in the history
Add new resources `routeros_ipv6_firewall_nat` and `routeros_ipv6_firewall_mangle`
  • Loading branch information
vaerh authored Dec 22, 2024
2 parents 6ff5f54 + 97d0362 commit 91ef494
Show file tree
Hide file tree
Showing 12 changed files with 1,436 additions and 1 deletion.
3 changes: 3 additions & 0 deletions examples/resources/routeros_ipv6_firewall_mangle/import.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#The ID can be found via API or the terminal
#The command for the terminal is -> :put [/ipv6/firewall/mangle get [print show-ids]]
terraform import routeros_ipv6_firewall_mangle.rule "*0"
9 changes: 9 additions & 0 deletions examples/resources/routeros_ipv6_firewall_mangle/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
resource "routeros_ipv6_firewall_mangle" "rule" {
action = "change-mss"
chain = "forward"
out_interface = "pppoe-out"
protocol = "tcp"
tcp_flags = "syn"
new_mss = "1130"
tcp_mss = "1301-65535"
}
3 changes: 3 additions & 0 deletions examples/resources/routeros_ipv6_firewall_nat/import.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#The ID can be found via API or the terminal
#The command for the terminal is -> :put [/ipv6/firewall/nat get [print show-ids]]
terraform import routeros_ipv6_firewall_nat.rule "*0"
5 changes: 5 additions & 0 deletions examples/resources/routeros_ipv6_firewall_nat/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
resource "routeros_ipv6_firewall_nat" "rule" {
action = "masquerade"
chain = "srcnat"
out_interface = "ether16"
}
4 changes: 3 additions & 1 deletion routeros/datasource_ipv6_firewall.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ func DatasourceIPv6Firewall() *schema.Resource {
Schema: map[string]*schema.Schema{
MetaSkipFields: PropSkipFields("packets"),

"rules": getIPv6FirewallFilterSchema(),
"mangle": getIPv6FirewallMangleSchema(),
"nat": getIPv6FirewallNatSchema(),
"rules": getIPv6FirewallFilterSchema(),
},
}
}
Expand Down
284 changes: 284 additions & 0 deletions routeros/datasource_ipv6_firewall_mangle.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,284 @@
package routeros

import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

func getIPv6FirewallMangleSchema() *schema.Schema {
return &schema.Schema{
Type: schema.TypeList,
Computed: true,
Optional: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
KeyFilter: PropFilterRw,
"id": {
Type: schema.TypeString,
Computed: true,
},
"action": {
Type: schema.TypeString,
Computed: true,
},
"address_list": {
Type: schema.TypeString,
Computed: true,
},
"address_list_timeout": {
Type: schema.TypeString,
Computed: true,
},
"bytes": {
Type: schema.TypeInt,
Computed: true,
},
"chain": {
Type: schema.TypeString,
Computed: true,
},
KeyComment: {
Type: schema.TypeString,
Computed: true,
},
"connection_bytes": {
Type: schema.TypeString,
Computed: true,
},
"connection_limit": {
Type: schema.TypeString,
Computed: true,
},
"connection_mark": {
Type: schema.TypeString,
Computed: true,
},
"connection_nat_state": {
Type: schema.TypeString,
Computed: true,
},
"connection_rate": {
Type: schema.TypeString,
Computed: true,
},
"connection_state": {
Type: schema.TypeString,
Computed: true,
},
"connection_type": {
Type: schema.TypeString,
Computed: true,
},
"content": {
Type: schema.TypeString,
Computed: true,
},
KeyDisabled: {
Type: schema.TypeBool,
Computed: true,
},
"dscp": {
Type: schema.TypeInt,
Computed: true,
},
"dst_address": {
Type: schema.TypeString,
Computed: true,
},
"dst_address_list": {
Type: schema.TypeString,
Computed: true,
},
"dst_address_type": {
Type: schema.TypeString,
Computed: true,
},
"dst_limit": {
Type: schema.TypeString,
Computed: true,
},
"dst_port": {
Type: schema.TypeString,
Computed: true,
},
KeyDynamic: {
Type: schema.TypeBool,
Computed: true,
},
// no fragment, hotspot
"icmp_options": {
Type: schema.TypeString,
Computed: true,
},
"in_bridge_port": {
Type: schema.TypeString,
Computed: true,
},
"in_bridge_port_list": {
Type: schema.TypeString,
Computed: true,
},
"in_interface": {
Type: schema.TypeString,
Computed: true,
},
"in_interface_list": {
Type: schema.TypeString,
Computed: true,
},
"ingress_priority": {
Type: schema.TypeInt,
Computed: true,
},
"invalid": {
Type: schema.TypeBool,
Computed: true,
},
"ipsec_policy": {
Type: schema.TypeString,
Computed: true,
},
"jump_target": {
Type: schema.TypeString,
Computed: true,
},
// no jump target, layer7
"limit": {
Type: schema.TypeString,
Computed: true,
},
"log": {
Type: schema.TypeBool,
Computed: true,
},
"log_prefix": {
Type: schema.TypeString,
Computed: true,
},
"new_connection_mark": {
Type: schema.TypeString,
Computed: true,
},
"new_dscp": {
Type: schema.TypeInt,
Computed: true,
},
"new_mss": {
Type: schema.TypeInt,
Computed: true,
},
"new_packet_mark": {
Type: schema.TypeString,
Computed: true,
},
"new_priority": {
Type: schema.TypeString,
Computed: true,
},
"new_routing_mark": {
Type: schema.TypeString,
Computed: true,
},
"new_ttl": {
Type: schema.TypeString,
Computed: true,
},
"nth": {
Type: schema.TypeString,
Computed: true,
},
"out_bridge_port": {
Type: schema.TypeString,
Computed: true,
},
"out_bridge_port_list": {
Type: schema.TypeString,
Computed: true,
},
"out_interface": {
Type: schema.TypeString,
Computed: true,
},
"out_interface_list": {
Type: schema.TypeString,
Computed: true,
},
"packet_mark": {
Type: schema.TypeString,
Computed: true,
},
"packet_size": {
Type: schema.TypeString,
Computed: true,
},
"passthrough": {
Type: schema.TypeBool,
Computed: true,
},
"per_connection_classifier": {
Type: schema.TypeString,
Computed: true,
},
"port": {
Type: schema.TypeString,
Computed: true,
},
"priority": {
Type: schema.TypeInt,
Computed: true,
},
"protocol": {
Type: schema.TypeString,
Computed: true,
},
"random": {
Type: schema.TypeInt,
Computed: true,
},
"routing_mark": {
Type: schema.TypeString,
Computed: true,
},
"src_address": {
Type: schema.TypeString,
Computed: true,
},
"src_address_list": {
Type: schema.TypeString,
Computed: true,
},
"src_address_type": {
Type: schema.TypeString,
Computed: true,
},
"src_port": {
Type: schema.TypeString,
Computed: true,
},
"src_mac_address": {
Type: schema.TypeString,
Computed: true,
},
"tcp_flags": {
Type: schema.TypeString,
Computed: true,
},
"tcp_mss": {
Type: schema.TypeString,
Computed: true,
},
"time": {
Type: schema.TypeString,
Computed: true,
},
"tls_host": {
Type: schema.TypeString,
Computed: true,
},
"ttl": {
Type: schema.TypeString,
Computed: true,
},
},
},
}
}
Loading

0 comments on commit 91ef494

Please sign in to comment.