百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
T

terraform-provider-routeros

> 数据库
开源

Mikrotik RouterOS 的 Terraform 提供程序

363 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

Mikrotik RouterOS 的 Terraform 提供程序

Terraform Provider RouterOS

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 ) and import it again (terraform import [options] ).

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
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
bash
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
hcl
required_providers {
  routeros = {
    source  = "terraform-routeros/routeros"
    version = "1.85.1"
  }
}

to

hcl
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:
hcl
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.
bash
cd routeros/
go run ../tools/drift/main.go
  • Submit your changes!

Here is a example of pull request.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Gomikrotikrouterosterraform-provider

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类数据库
定价开源

> 相关工具

P
PostgreSQL
功能强大的开源关系型数据库
R
Redis
内存数据结构存储,常用作缓存与队列
M
MySQL
广泛使用的开源关系型数据库