terraform-routeros / terraform-provider-routeros

Terraform Provider for Mikrotik RouterOS
Mozilla Public License 2.0
165 stars 46 forks source link

routeros_snmp_community Addresses Doesn't Accept Multiple Addresses #495

Closed johnelliott closed 1 week ago

johnelliott commented 2 weeks ago

Describe the bug routeros_snmp_community addresses doesn't allow multiple address.

To Reproduce

resource "routeros_snmp_community" "mything" {
  addresses = "10.0.1.12,10.10.0.129"
  name      = "mything"
}

Fails validation

Expected behavior

resource "routeros_snmp_community" "mything" {
  addresses = ["10.0.1.12", "10.10.0.129"]
  name      = "mything"
}

Should yeild

Terraform will perform the following actions:

  # routeros_snmp_community.mything will be updated in-place
  ~ resource "routeros_snmp_community" "mything" {
      ~ addresses               = [
          - "10.0.1.12/32",
          + "10.0.1.12",
          + "10.10.0.129",
        ]
        id                      = "*1"
        name                    = "mything"
        # (7 unchanged attributes hidden)
    }

Debug Information

Stack Trace

Additional context

Thanks so much for all this work. I would like to submit a patch but I'm a newbie to Terraform and provider development, see below.

ROS v7.15: I went to do an SNMP community setup and realized the config with comma-separated ips in cidr notation doesn't work e.g. "1.1.1.1,8.8.8.8" or "1.1.1.1/8,8.8.8.8/32" doesn't work. It seems like it's accepting a string, which is fine, but because it's using the ip address validator, the comma-separated list fails.

I did manage to set up a basic dev environment and tried to steal some of the snmp-trap schema that uses a list of addresses into the address part of the routeros_snmp_community definition and a full test with hardware did work, but I wasn't able to figure out how to address the Default value and didn't see any default values with lists or sets in the project.

Anyway, I'd love to contribute but may need a little help on-boarding.

vaerh commented 1 week ago

:tada: This issue has been resolved in version 1.54.3 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: