Lab fork of terraform-routeros/terraform-provider-routeros: upstream releases + fixes not yet merged upstream (vrf read-only on ip_address, upstream #944/#984). Published as an OpenTofu OCI provider mirror.
  • Go 99.3%
  • Go Template 0.4%
  • Shell 0.2%
  • Makefile 0.1%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-11-17 21:19:57 +00:00
.devcontainer chore: move task file to the correct location and update command (#863) 2025-11-18 21:37:35 +03:00
.github chore(deps): bump actions/cache from 4 to 5 2025-12-12 03:06:44 +00:00
.vscode chore: move task file to the correct location and update command (#863) 2025-11-18 21:37:35 +03:00
docs chore(release): 1.99.0 2026-01-21 10:59:37 +00:00
examples Ensure consistent line endings 2026-01-20 15:16:05 +00:00
lab lab: release.sh logs in just in time with the fj token 2026-11-17 16:19:49 -05:00
routeros feat(system_user): document password_wo edge cases 2026-11-17 16:04:23 -05:00
templates feat(import): Add import by resource identity 2025-12-03 16:16:17 +03:00
tools chore(importer) Add support for command line flags, and move from shell import script to tofu import block 2025-11-28 16:48:07 +01:00
.gitattributes Ensure consistent line endings 2026-01-20 15:16:05 +00:00
.gitignore feat: Add attributes to resouce ip_dhcp_server,interface_vlan … (#861) 2025-11-10 15:52:42 +03:00
.goreleaser.yml chore: Update goreleaser configuration version 2025-09-25 10:17:50 +03:00
.releaserc chore: Add committing of files that change after auto-generation 2025-10-15 09:28:30 +03:00
CHANGELOG.md chore(release): 1.99.1 2026-03-08 18:01:21 +00:00
CODEOWNERS chore: Add codeowners 2023-02-23 23:25:28 +00:00
go.mod Merge pull request #933 from terraform-routeros/dependabot/go_modules/golang.org/x/crypto-0.48.0 2026-03-08 21:00:15 +03:00
go.sum Merge pull request #933 from terraform-routeros/dependabot/go_modules/golang.org/x/crypto-0.48.0 2026-03-08 21:00:15 +03:00
LAB.md lab: release.sh logs in just in time with the fj token 2026-11-17 16:19:49 -05:00
LICENSE.md Add license 2021-12-10 04:56:03 +00:00
main.go fix: Fix the import path 2023-04-03 20:20:38 +03:00
Makefile fix(provider): Add attribute drift handling between ROS versions 2025-02-11 09:19:10 +03:00
package.json chore(release): 1.99.1 2026-03-08 18:01:21 +00:00
README.md Add alternative plugin testing description 2025-11-29 20:08:43 +01:00

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.24.2 and ROS 7.12, 7.15, 7.16 (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!

Testing

You can build the provider locally to test fixes by following these intructions:

  • Build and copy the provider where Terraform reads it
go build *.go && \
mkdir -p ~/.terraform.d/plugins/terraform.local/local/routeros/1.0.0/$(uname -s | tr '[:upper:]' '[:lower:]')_$(uname -m) && \
mv main ~/.terraform.d/plugins/terraform.local/local/routeros/1.0.0/$(uname -s | tr '[:upper:]' '[:lower:]')_$(uname -m)/terraform-provider-routeros_v1.0.0
  • Change provider from
required_providers {
  routeros = {
    source  = "terraform-routeros/routeros"
    version = "1.85.1"
  }
}

to

required_providers {
  routeros = {
    source  = "terraform.local/local/routeros"
    version = "1.0.0"
  }
}
  • Clean your providers, init and apply
  • Alternatively, you can edit/create ~/.terraformrc add add a provider installation block like:
provider_installation {
  dev_overrides {
     "terraform-routeros/routeros" = "/path/to/your/git/clone"
  }

  direct {
  }
}

and then build the provider using

go build -o terraform-provider-routeros *.go

in order for Terraform to find it.

Fixing RouterOS property drift

Sometimes RouterOS might introduce a breaking change on a property. You can easilfy contribute to the provider by following these intructions:

  • Edit routeros/mikrotik_resource_drift.yaml. Add the resource used as well as the old property name and the new one
  • Perform the generator. It should edit file routeros/mikrotik_resource_drift.go.
cd routeros/
go run ../tools/drift/main.go
  • Submit your changes!

Here is a example of pull request.