Router OS 7.18 beta 6 & Terraform Provider v1.76.3 & -> Error: unknown RouterOS reply word: !empty

Hello,

I have uncounter a bug with the Terraform Module with this Beta version: https://github.com/terraform-routeros/terraform-provider-routeros/issues/661

Describe the bug
When using terraform with RouterOS on a Mikrotik Switch CCR2116 I have this error when something is not found.

provider registry.terraform.io/terraform-routeros/routeros v1.76.3
To Reproduce
Don’t know how to reproduce it but seams to be frequent on multiple ressources.

Expected behavior
Not an unknown reply word

Debug Information
Error: unknown RouterOS reply word: !empty

│ with module.l3-routers.routeros_ip_route.ip-routes[“VRF-XXX-WAN_DST-0.0.0.0/0_GW-XXX”],
│ on ../../shared/src/mikrotik-l3-routers/main.tf line 38, in resource “routeros_ip_route” “ip-routes”:
│ 38: resource “routeros_ip_route” “ip-routes” {

Thanks for your support

It’s noted in the release notes:

*) console - put !empty sentence when API query returns nothing;

Thank you, I have relayed the info to the Mikrotik Terraform Provider team

Well, it likely the https://github.com/go-routeros/routeros team that will have to fix it. I think it’s just another case “!empty” that does nothing would fix it here: https://github.com/go-routeros/routeros/blob/c7c9b83f89d6d8e4c4a50e21c0fd99ba9f4b5fd3/listen.go#L113

Also, you should be able to use REST API mode in Terraform, and that would avoid the issue in 7.18beta for now.

On the Mikrotik side, the !empty should be documented in https://help.mikrotik.com/docs/spaces/ROS/pages/47579160/API#API-!trap.

Express fix by the RouterOS Provider