terraform-routeros / terraform-provider-routeros

Terraform Provider for Mikrotik RouterOS
Mozilla Public License 2.0
191 stars 55 forks source link

Implement ip/service data source #393

Closed OJFord closed 6 months ago

OJFord commented 6 months ago

Closes #391.

Used successfully like:

data "routeros_ip_services" "router" {
  provider = routeros.router
}

resource "routeros_ip_service" "router-disabled" {
  provider = routeros.router
  for_each = { for s in data.routeros_ip_services.router.services : s.name => s if s.name != "www-ssl" }

  disabled = true
  numbers  = each.value.name
  port     = each.value.port
}

to test.

vaerh commented 6 months ago

That's great! I have a request for you to add an example file for this data source /examples/data-sources/... The release of your add-on will be after fixing the publication in the TF registry.

OJFord commented 6 months ago

Ah sorry, no problem, I just copied one of the others that only had a basic example like that, but yes good idea.

Thanks!