Skip to content

Commit

Permalink
fix(snmp-community): Allow a set of addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
johnelliott committed Jun 22, 2024
1 parent 6bb0fdd commit 472fba5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
3 changes: 2 additions & 1 deletion docs/resources/snmp_community.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ resource "routeros_snmp_community" "test" {
name = "private"
read_access = true
security = "private"
addresses = ["192.0.2.0/24", "198.51.100.1", "::" ]
write_access = true
}
```
Expand All @@ -22,7 +23,7 @@ resource "routeros_snmp_community" "test" {

### Optional

- `addresses` (String) Addresses from which connections to SNMP server is allowed.
- `addresses` (Set of String) Set of IP (v4 or v6) addresses or CIDR networks from which connections to SNMP server is allowed.
- `authentication_password` (String, Sensitive) Password used to authenticate the connection to the server (SNMPv3).
- `authentication_protocol` (String) The protocol used for authentication (SNMPv3).
- `comment` (String)
Expand Down
16 changes: 11 additions & 5 deletions routeros/resource_snmp_community.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,17 @@ func ResourceSNMPCommunity() *schema.Resource {
MetaId: PropId(Id),

"addresses": {
Type: schema.TypeString,
Optional: true,
Default: "::/0",
Description: "Addresses from which connections to SNMP server is allowed.",
ValidateFunc: validation.IsIPAddress,
Type: schema.TypeSet,
Optional: true,
Description: "Set of IP (v4 or v6) addresses or CIDR networks from which connections to SNMP server is allowed.",
Elem: &schema.Schema{
Type: schema.TypeString,
ValidateFunc: validation.Any(
validation.IsIPv4Address,
validation.IsIPv6Address,
validation.IsCIDRNetwork(0, 128),
),
},
},
"authentication_password": {
Type: schema.TypeString,
Expand Down

0 comments on commit 472fba5

Please sign in to comment.