Giter VIP home page Giter VIP logo

terraform-provider-routeros's Introduction

Terraform Provider RouterOS

module testing workflow

Note: In release 1.43, the resource schemas have been changed:

  • routeros_routing_bgp_connection
  • routeros_ipv6_neighbor_discovery
  • routeros_interface_wireguard_peer

For the first two to work correctly, you must remove the resource state (terraform state rm <name>) and import it again (terraform import [options] <name> <id>).

Purpose

This provider allows you to configure Mikrotik routers using old API or REST API, using or not using TLS. Compatibility testing is only performed within ROS version 7.x.

From version 1.0.0, the provider has been rewritten by vaerh, and their fork has now been merged. This version drastically improves adding new endpoints to the provider, enabling significantly easier development. vaerh has been added as a maintainer to this project.

We are not affiliated in any way with Mikrotik or the development of RouterOS

Using the provider

To get started with the provider, you first need to enable the REST API on your router. You can follow the Mikrotik documentation on this, but the gist is to create an SSL cert (in /system/certificates) and enable the web-ssl service (in /ip/services) which uses that certificate. After that, include the following in your Terraform manifests:

terraform {
  required_providers {
    routeros = {
      source = "terraform-routeros/routeros"
    }
  }
}

provider "routeros" {
  hosturl  = "(http|https|api|apis)://my.router.local[:port]"
  username = "my_username"
  password = "my_super_secret_password"
}

For more in-depth documentation about each of the resources and datasources, please read the documentation on Hashicorp's Provider registry

Versions tested

  • go 1.21 and ROS 7.12, 7.13, 7.14 (stable)

Changelog

For a detailed changelog, please see the changelog.md.

Contributing

This version of the module greatly simplifies the process of adding new resources. You are welcome!

terraform-provider-routeros's People

Contributors

argjolan avatar bonjonson avatar danielnachtrub avatar davidkern avatar dependabot[bot] avatar dmaes avatar dokmic avatar durandguru avatar gfenn-newbury avatar grigorescu avatar jfroche avatar jlpedrosa avatar johnelliott avatar ksmets avatar melchiormoulin avatar michael-robbins avatar mirceanton avatar mrhamburg avatar nemcikjan avatar ojford avatar redcancode avatar rifelpet avatar sebastiaandurand avatar semantic-release-bot avatar stasjok avatar toalaah avatar vaerh avatar voima-eetu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

terraform-provider-routeros's Issues

Bridge interface: pvid out of range

Describe the bug
Not an expert for RouterOS but when I want to create a bridge interface without setting the pvid parameter, I'm getting following error:

When applying changes to routeros_interface_bridge.bridge, provider "provider[\"registry.terraform.io/gnewbury1/routeros\"]" produced an unexpected new value: Root resource was present, but now absent.

After looking into Terraform debug logs I noticed following line:

{"@level":"warn","@message":"unexpected data","@timestamp":"2022-10-23T14:04:28.141949+02:00","registry.terraform.io/gnewbury1/routeros:stdout":"value of pvid out of range (1..4094)"}

Based on the error and according to the [docs[(https://help.mikrotik.com/docs/display/ROS/Bridging+and+Switching) I'm assuming that default value should be 1 and not 0 as in the current state:

"pvid": {
    Type:     schema.TypeInt,
    Optional: true,
    Default:  0,
},

To Reproduce
Try to apply example configuration of routeros_interface_bridge

Expected behavior
Successful creation of bridge interface

Stack Trace

routeros_interface_bridge.bridge: Modifying... [id=*<id>]
....
{"@level":"trace","@message":"received data","@module":"provider.stdio","@timestamp":"2022-10-23T14:04:28.141913+02:00","channel":"STDOUT","len":36}
{"@level":"warn","@message":"unexpected data","@timestamp":"2022-10-23T14:04:28.141949+02:00","registry.terraform.io/gnewbury1/routeros:stdout":"value of pvid out of range (1..4094)"}
....
│ Error: Provider produced inconsistent result after apply
│
│ When applying changes to routeros_interface_bridge.bridge, provider "provider[\"registry.terraform.io/gnewbury1/routeros\"]" produced an unexpected new value: Root resource was present, but now absent.
│
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.

Additional context
Versions:
Terraform: 1.3.3
Provider: 0.3.4
RouterOS: 7.5

Ability to manage SSL Certificates

It would be very cool to help add support for let's encrypt by combining with the acme provider, things needed for this:

Lifecycle of certificate
Assign to services, api, www, ikev2

Update ipsec configuration - help needed for workaround.

When I found this I was hoping to be able to update my Oracle Cloud Site-to-Site VPN settings when the remote addresses change, if not to set up the whole thing, but there is no ipsec support. I suppose it would be quite a task to add it.

But, I was hoping people here who are familiar with both Mikrotik and terraform could help with my workaround:

The IP address of the tunnel changes every time it is remade in terraform. I should be able to update it using the terraform provider local-exec.

resource "null_resource" "update_router_vpn" {
  depends_on = [oci_core_ipsec_connection_tunnel_management.oci_ipsec_connection_tunnel_management_a]
  provisioner "local-exec" {
    when    = create
    command = "/ip ipsec peer set name=oracle1-peer address=1.1.1.1/32 numbers=0"

    connection {
      type = "ssh"
      user = var.username
      host    = "[var.username]@[var.onprem_router_name]"
      agent   = true
      timeout = "20s"
    }
  }
}

This doesn't work. I get this error:

╷
│ Error: local-exec provisioner error
│
│   with null_resource.update_router_vpn,
│   on mikrotik_vpn.tf line 2, in resource "null_resource" "update_router_vpn":
│    2:   provisioner "local-exec" {
│
│ Error running command '/ip ipsec peer set name=oracle1-peer address=1.1.1.1/32 numbers=0': exit status 127. Output: /bin/sh: 1: /ip: not found

I can replace the 1.1.1.1 with a data source, but I need to know how to get this resource(?) working first.

Add Github actions to repository

GitHub actions should be added to the repository to:

  • Create an ephemeral testing environment
  • Enable automated testing on a pull request
  • Enable releases to the Terraform registry to happen automatically when a new version tag is created

Provider prints the authentication credentials to stdout

Describe the bug
There is a call to fmt.Println for the HTTP request after the HTTP Basic Auth credentials are set, resulting in the base64 encoded credentials being written to stdout. The base64 string can easily be decoded to retrieve the original credentials. This is a significant security issue as it is very common for the output from stdout and stderr to be logged and the logs to be shipped to logging services where the logs are visible to many users.

https://github.com/GNewbury1/terraform-provider-routeros/blob/0cab8e158a493160863e5d471fea65d35507445f/client/client.go#L55-L59

To Reproduce
https://go.dev/play/p/0_Tn0cCp7lM

Expected behavior
Provider does not write credentials to stdout.

Additional context
This issue may also exist elsewhere in the code, I haven't looked. You should remove all debug fmt.Print commands from the provider.

routeros_interface_list and - Warning: Field not found

Describe the bug
Warning: Field not found

│ with routeros_interface_list.lan,
│ on interface-lists.tf line 1, in resource "routeros_interface_list" "lan":
│ 1: resource "routeros_interface_list" "lan" {

│ [MikrotikResourceDataToTerraform] The field was lost during the Schema development: builtin <<<= false

To Reproduce
Create Interface List
resource "routeros_interface_list" "lan" {
name = "LAN"
}

Bridge and IGMP setting

Describe the bug
I enable IGMP on the bridge. After apply I get an error about MikrotikResourceDataToTerraform

To Reproduce
resource "routeros_bridge" "bridge" {
name = "bridge"
ingress_filtering = true
protocol_mode = "rstp"
priority = "0x3000"
igmp_snooping = true
vlan_filtering = true
}

Expected behavior
A clear and concise description of what you expected to happen.

Additional context
Error
│ Warning: Field not found

│ with routeros_bridge.bridge,
│ on ports.tf line 1, in resource "routeros_bridge" "bridge":
│ 1: resource "routeros_bridge" "bridge" {

│ [MikrotikResourceDataToTerraform] The field was lost during the Schema development: igmp_version <<<= 2

Add templates for issues

Add templates for issues:

  • Bug reports
  • Feature requests/enhancements
  • Documentation and non-functional issues
  • Continuous Integration issues

Unable to create an address

Describe the bug
Hello!
I might be doing wrong but I'm trying something that seems very simple without success. I'm trying to create a bridge and then create an address, but it is failing with a cryptic error (see logs with debug logs below).
The bridge is successfully created, but the address doesn't. It fails no matter what I try (using reference for interface name, using ref for the interface id, manually using the interface name), as well as interchanging the mask /24 between the address and network (I think I usually configure it on the address, but the documentation mentions to set it on the network)

To Reproduce
Code is very simple (on top of the provider config and some datasource)

resource "routeros_interface_bridge" "main_bridge" {
    name = "Main bridge"
    pvid = 1
    vlan_filtering = true
}

resource "routeros_ip_address" "test_addr" {
    address   = "192.168.99.1/24" #address with mask as I see it in my mikrotik config
    interface = "${routeros_interface_bridge.main_bridge.name}"
    network   = "192.168.99.0"
}

Tried as well:

resource "routeros_interface_bridge" "main_bridge" {
    name = "Main bridge"
    pvid = 1
    vlan_filtering = true
}


resource "routeros_ip_address" "test_addr" {
    address   = "192.168.99.1"
    interface = "${routeros_interface_bridge.main_bridge.name}"
    network   = "192.168.99.0/24" # mask with the network - which is what I see in the doc for the plugin
}

Expected behavior
Bridge is created, and the ip address is created.

Stack Trace

2023-02-12T10:31:56.050+0100 [WARN]  unexpected data: registry.terraform.io/gnewbury1/routeros:stdout="&{PUT https://10.42.30.10/rest/ip/address HTTP/1.1 1 1 map[Authorization:[Basic dGVycmFmb3JtOlFFWEBrdWE4ZnV3LW1jeSFjdW4=] Content-Type:[application/json]] {{"address":"192.168.99.1/24","disabled":"false","interface":"Main bridge","invalid":"false","network":"192.168.99.0"}} 0x12eede0 117 [] false 10.42.30.10 map[] map[] <nil> map[]   <nil> <nil> <nil> 0xc0000b4050}"
2023-02-12T10:31:56.153+0100 [WARN]  unexpected data: registry.terraform.io/gnewbury1/routeros:stdout=400
2023-02-12T10:31:56.153+0100 [WARN]  unexpected data: registry.terraform.io/gnewbury1/routeros:stdout="unknown parameter invalid"
2023-02-12T10:31:56.153+0100 [INFO]  provider.terraform-provider-routeros_v0.3.2: 2023/02/12 10:31:56 [ERROR] An error was encountered while sending a PUT request to the API: timestamp=2023-02-12T10:31:56.152+0100
2023-02-12T10:31:56.153+0100 [INFO]  provider.terraform-provider-routeros_v0.3.2: 2023/02/12 10:31:56 unknown parameter invalid: timestamp=2023-02-12T10:31:56.153+0100
2023-02-12T10:31:56.155+0100 [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/gnewbury1/routeros/0.3.2/darwin_amd64/terraform-provider-routeros_v0.3.2 pid=20949 error="exit status 1"
2023-02-12T10:31:56.155+0100 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Canceled desc = context canceled"
2023-02-12T10:31:56.155+0100 [ERROR] plugin.(*GRPCProvider).ApplyResourceChange: error="rpc error: code = Canceled desc = context canceled"
2023-02-12T10:31:56.169+0100 [ERROR] vertex "routeros_ip_address.test_addr" error: Request cancelled
╷
│ Error: Request cancelled
│
│   with routeros_ip_address.test_addr,
│   on bridge.tf line 8, in resource "routeros_ip_address" "test_addr":
│    8: resource "routeros_ip_address" "test_addr" {
│
│ The plugin.(*GRPCProvider).ApplyResourceChange request was cancelled.
╵```
**Additional context**
I did the creation of certs etc. successfully, I'm able to create the bridge but get a failure when creating the address. Starting from a brand new RB5009 (with default config). Failed on 7.6, and 7.7

Add resource for IP Pools

Add resource for IP Pools

  • In the Go client
  • In the Terraform provider

This is to be used by a dhcp server (implemented in #3)

routeros_ip_dhcp_server - Provider produced inconsistent result after apply

Describe the bug
This happens when running terraform apply. I am also unable to make an ip address resource. It throws error no matter what I try.
My below code was working for a bit then started giving this error after I kept trying to get the IP address resource to work.

To Reproduce

terraform {
  required_providers {
    routeros = {
      source = "GNewbury1/routeros"
    }
  }
}

provider "routeros" {
  hosturl  = "https://172.21.0.1"
  username = "username"
  password = "password"
  insecure = true
}


locals {
  network71 = {
    name = "vlan71-smartDevices"
    address = "10.71.0.0"
    gateway = "10.71.0.1"
    cidr = "/24"
    vlan = 71
  }
  domain   = "yoshi.lan"
}

resource "routeros_interface_vlan" "vlan-vlan71-smartDevices" {
  interface = "bridge-lan"
  name      = local.network71.name
  vlan_id   = local.network71.vlan
}
resource "routeros_ip_pool" "pool-vlan71-smartDevices" {
  name   = local.network71.name
  ranges = "10.0.71.100-10.0.71.200"
}
resource "routeros_ip_dhcp_server_network" "dhcpNetwork-vlan71-smartDevices" {
  address    = format("%s%s",local.network71.address,local.network71.cidr)
  gateway    = local.network71.gateway
  dns_server = local.network71.gateway
  domain     = local.domain
}
resource "routeros_ip_dhcp_server" "dhcpServer-vlan71-smartDevices" {
  address_pool = local.network71.name
  interface    = local.network71.name
  name         = local.network71.name
}

Output:

routeros_ip_dhcp_server.dhcpServer-vlan71-smartDevices: Creating...
routeros_interface_vlan.vlan-vlan71-smartDevices: Creating...
routeros_ip_pool.pool-vlan71-smartDevices: Creating...
routeros_ip_dhcp_server_network.dhcpNetwork-vlan71-smartDevices: Creating...
routeros_ip_dhcp_server_network.dhcpNetwork-vlan71-smartDevices: Creation complete after 0s [id=*18]
routeros_ip_pool.pool-vlan71-smartDevices: Creation complete after 0s [id=*1C]
routeros_interface_vlan.vlan-vlan71-smartDevices: Creation complete after 0s [id=*24]
╷
│ Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to routeros_ip_dhcp_server.dhcpServer-vlan71-smartDevices, provider
│ "provider[\"registry.terraform.io/gnewbury1/routeros\"]" produced an unexpected new value: Root resource was
│ present, but now absent.
│ 
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.

Expected behavior
Expected to run without error and create the dhcp server resource

Stack Trace
If applicable, add the stack trace the crash produced.

Additional context
Add any other context about the problem here.

Changing the identity does not work on a CRS112

My code:

#tfvars file content: identity = "mt-crs112"

variable "identity" {
  type = string
}

resource "routeros_system_identity" "ros_identity" {
    name = var.identity
}

Output of terraform apply:

routeros_system_identity.ros_identity: Refreshing state... [id=mt-oldname]

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the
following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # routeros_system_identity.ros_identity will be updated in-place
  ~ resource "routeros_system_identity" "ros_identity" {
        id   = "mt-oldname"
      ~ name = "mt-oldname" -> "mt-crs112"
    }

Plan: 0 to add, 1 to change, 0 to destroy.
routeros_system_identity.ros_identity: Modifying... [id=mt-oldname]
routeros_system_identity.ros_identity: Modifications complete after 1s [id=mt-oldname]

After apply the name is still "mt-oldname".

Mikrotik model: CRS112
RouterOS: 7.6 (same result with 7.4)
Terraform: v1.3.7
Provider: v0.4.0
Go: go1.19.4

Add resource for ip routes

Add resource for ip routes

  • In the Go client
  • In the Terraform provider

Note, this does not include BGP at this time

Firewall filter rules order

Is there any way to make sure firewall filter rules are in a specific order? So when adding a new rule I can make sure it's added at the top, or just before the final drop rule?

Add documentation for importing existing resources

Is your feature request related to a problem? Please describe.
I discovered this after doing some manual configuration of my devices, as such I already had some of the basic resources created. It was not a huge deal for me, as I had not gotten very far, but I had to do some testing/guessing to figure out the generated IDs for my existing resources. It would be nice to have this documented like other Terraform providers offer. Random example

Describe the solution you'd like
I can see importer attributes on most/all of the resource schemas, so I am fairly certain this is just documentation lacking. Please add documentation regarding retrieving IDs for importing the various resources this provider handles. I would be happy to help track these down and add to the repo, but quite honestly I've never written a provider, so I'm not where that would need to be added. If you can point me in the right direction I'd be happy to send a PR.

Additional context
Was able to successfully import a routeros_ip_address with:

terraform import routeros_ip_address.router *1

Problem getting it to work

Describe the bug
I want to play around with the provider and I am testing and can't get it to work. Get an Provider produced inconsistent result after apply error (see below). Testing on RouterOS 7.4. Is this a bug or do I do something wrong?

To Reproduce
I created a simple file:
terraform {
required_providers {
routeros = {
source = "GNewbury1/routeros"
}
}
}

provider "routeros" {
hosturl = "https://10.252.10.1"
username = "abc"
password = "appeltaart"
insecure = true
}

resource "routeros_ip_pool" "pool" {
name = "my_ip_pool"
ranges = "10.0.0.100-10.0.0.200"
}

Expected behavior
It works..

Stack Trace
If applicable, add the stack trace the crash produced.

Additional context
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the
following symbols:

  • create

Terraform will perform the following actions:

routeros_ip_pool.pool will be created

  • resource "routeros_ip_pool" "pool" {
    • id = (known after apply)
    • name = "my_ip_pool"
    • ranges = "10.0.0.100-10.0.0.200"
      }

Plan: 1 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.

Enter a value: yes

routeros_ip_pool.pool: Creating...

│ Error: Provider produced inconsistent result after apply

│ When applying changes to routeros_ip_pool.pool, provider "provider["registry.terraform.io/gnewbury1/routeros"]"
│ produced an unexpected new value: Root resource was present, but now absent.

│ This is a bug in the provider, which should be reported in the provider's own issue tracker.

Bridge and STP

Describe the bug
I set STP to RSTP and use priority's. During Plan or apply I get an error about MikrotikResourceDataToTerraform

To Reproduce
resource "routeros_bridge" "bridge" {
name = "bridge"
ingress_filtering = true
protocol_mode = "rstp"
priority = "0x3000"
igmp_snooping = true
vlan_filtering = true
}

Additional context
│ Warning: Field not found

│ with routeros_bridge_port.sfp-sfpplus1,
│ on ports.tf line 88, in resource "routeros_bridge_port" "sfp-sfpplus1":
│ 88: resource "routeros_bridge_port" "sfp-sfpplus1" {

│ [MikrotikResourceDataToTerraform] The field was lost during the Schema development: designated_bridge <<<=
│ 0x2000.2C:C8:1B:05:76:BF

Migrating from vaerh provider, issue with bridge

Describe the bug
I used the @vaerh provider before and want to switch to this one after the merge. If I only replace the provider and run a plan. It wants to create a new bridge.

To Reproduce
Current setup in vaerh provider:
resource "routeros_bridge" "bridge" {
name = "bridge"
ingress_filtering = true
priority = "0x3000"
vlan_filtering = true
}

Switch providers and run plan

routeros_bridge.bridge will be created

  • resource "routeros_bridge" "bridge" {
    • actual_mtu = (known after apply)
    • admin_mac = (known after apply)
    • ageing_time = "5m"
    • arp = "enabled"
    • arp_timeout = "auto"
    • auto_mac = true
    • disabled = false
    • ether_type = "0x8100"
    • fast_forward = (known after apply)
    • forward_delay = "15s"
    • frame_types = "admit-all"
    • id = (known after apply)
    • igmp_snooping = false
    • ingress_filtering = true
    • l2mtu = (known after apply)
    • mac_address = (known after apply)
    • max_message_age = "20s"
    • mtu = "auto"
    • name = "bridge"
    • priority = "0x3000"
    • protocol_mode = "rstp"
    • pvid = 1
    • running = (known after apply)
    • transmit_hold_count = 6
    • vlan_filtering = true
      }

Expected behavior
Just migrate

Additional context

DHCP and MikrotikResourceDataToTerraform

Describe the bug
Set DHCP reservations via routeros_ip_dhcp_server_lease. If the fields Active MAC Address, Active Hostname and Expires After are filled by an active reservation this error appears.

BTW I Love what you guys are doing with this provider! I find it very useful.

To Reproduce
resource "routeros_ip_dhcp_server_lease" "vlan-112-gs-cu-03" {
address = "172.22.112.103"
mac_address = "00:1D:C1:94:87:42"
server = routeros_dhcp_server.vlan-112-dhcp-server.name
comment = "GS-CU-03"
}

Additional context
Different output because of a lot of warnings:
{"@Level":"warn","@message":"Warning: Field not found","@module":"terraform.ui","@timestamp":"2023-02-16T22:24:52.168451+01:00","diagnostic":{"severity":"warning","summary":"Field not found","detail":"[MikrotikResourceDataToTerraform] The field was lost during the Schema development: active_mac_address \u003c\u003c\u003c= 00:1D:C1:94:87:42","address":"routeros_ip_dhcp_server_lease.vlan-112-gs-cu-03","range":{"filename":"vlan-112-dante.tf","start":{"line":95,"column":62,"byte":2971},"end":{"line":95,"column":63,"byte":2972}},"snippet":{"context":"resource "routeros_ip_dhcp_server_lease" "vlan-112-gs-cu-03"","code":"resource "routeros_ip_dhcp_server_lease" "vlan-112-gs-cu-03" {","start_line":95,"highlight_start_offset":61,"highlight_end_offset":62,"values":[]}},"type":"diagnostic"}

{"@Level":"warn","@message":"Warning: Field not found","@module":"terraform.ui","@timestamp":"2023-02-16T22:24:52.168451+01:00","diagnostic":{"severity":"warning","summary":"Field not found","detail":"[MikrotikResourceDataToTerraform] The field was lost during the Schema development: active_mac_address \u003c\u003c\u003c= 00:1D:C1:94:87:42","address":"routeros_ip_dhcp_server_lease.vlan-112-gs-cu-03","range":{"filename":"vlan-112-dante.tf","start":{"line":95,"column":62,"byte":2971},"end":{"line":95,"column":63,"byte":2972}},"snippet":{"context":"resource "routeros_ip_dhcp_server_lease" "vlan-112-gs-cu-03"","code":"resource "routeros_ip_dhcp_server_lease" "vlan-112-gs-cu-03" {","start_line":95,"highlight_start_offset":61,"highlight_end_offset":62,"values":[]}},"type":"diagnostic"}

image

Datasources that return array contain wrong values

Describe the bug
I setup a RouterOS with two addresses (*1 and *2, using 10.0.9.1/24 and 192.168.88.1/24), the REST api also returns the correct values.

Using the terraform provider, the list contains the same address twice and is missing the first one. When I create a third address, the array contains three times the last one.

This is also reproducable for the interfaces and routes datasource.

ip_addresses = {
  "addresses" = tolist([
    {
      "actual_interface" = "ether1"
      "address" = "192.168.88.1/24"
      "disabled" = true
      "dynamic" = false
      "id" = "*2"
      "interface" = "ether1"
      "invalid" = false
      "network" = "192.168.88.0"
    },
    {
      "actual_interface" = "ether1"
      "address" = "192.168.88.1/24"
      "disabled" = true
      "dynamic" = false
      "id" = "*2"
      "interface" = "ether1"
      "invalid" = false
      "network" = "192.168.88.0"
    },
  ])
  "id" = "terraform-20220120102446891700000001"
}

To Reproduce
Setup multiple routes, addresses or interfaces and query those.

Minimal terraform example:

provider "routeros" {
  hosturl  = "https://10.0.9.150"
  username = "admin"
  password = ""
  insecure = true
}

data "routeros_interfaces" "interfaces" {}

data "routeros_ip_routes" "routes" {}

data "routeros_ip_addresses" "addresses" {}


output "interfaces" {
  value = data.routeros_interfaces.interfaces
}

output "ip_addresses" {
  value = data.routeros_ip_addresses.addresses
}

output "routes" {
  value = data.routeros_ip_routes.routes
}


Expected behavior
Array with the correct entries.

Firewall Filter Rule Create - src_port is pulling "Port" not "src_port" in the return

Describe the bug
In the code, the returned object (d.set) has a property (src_port) that is being filled by the returned object's "Port" attribute. This should be filled by the returned object's "SrcPort" attribute.

To Reproduce
In the routeros/resource_ip_firewall_filter.go file, on line 475, the line reads:
d.Set("src_port", res.Port).

Expected behavior
In the routeros/resource_ip_firewall_filter.go file, on line 475, the line should read:
d.Set("src_port", res.SrcPort).

Stack Trace
No Stack Trace, does not crash, just returns incorrect data.

Additional context
No additional context here.

Bridge resource creating 400 errors

Describe the bug
After creating a bridge interface, subsequent plans will fail due to the bridge resource creating a 400 error

To Reproduce
Create a bridge interface, then run a plan afterwards

Expected behavior
Subsequent plan completes successfully

Stack Trace

╷
│ Error: unknown error, status code: 400
│ 
│   with routeros_interface_bridge.main_bridge,
│   on main.tf line 39, in resource "routeros_interface_bridge" "main_bridge":
│   39: resource "routeros_interface_bridge" "main_bridge" {
│ 
╵

Ability for create containers

Is your feature request related to a problem? Please describe.
A container is MikroTik's implementation of Linux containers, allowing users to run containerized environments within RouterOS. For example run traefik would be very useful!

Describe the solution you'd like
Manage lifecycle for containers, env variables, versions, etc.

Additional context
Here oficial guide for create container
https://help.mikrotik.com/docs/display/ROS/Container

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.