Skip to content

Commit

Permalink
feat: Add http scheme support for the REST API
Browse files Browse the repository at this point in the history
  • Loading branch information
dokmic authored and vaerh committed Mar 29, 2024
1 parent 56cee14 commit c326052
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ terraform {
}
provider "routeros" {
hosturl = "(https|api|apis)://my.router.local[:port]"
hosturl = "(http|https|api|apis)://my.router.local[:port]"
username = "my_username"
password = "my_super_secret_password"
}
Expand Down
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ resource "routeros_interface_gre" "gre_hq" {
### Required

- `hosturl` (String) URL of the ROS router. Include including the scheme:
- `http` new REST API
- `https` new REST API with TLS/SSL
- `api` old API without TLS/SSL on port 8728
- `apis` old API with TLS/SSL 8729
Expand Down
1 change: 1 addition & 0 deletions routeros/mikrotik_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ func NewClient(ctx context.Context, d *schema.ResourceData) (interface{}, diag.D

// Parse URL.
switch routerUrl.Scheme {
case "http":
case "https":
case "apis":
routerUrl.Scheme = ""
Expand Down
3 changes: 2 additions & 1 deletion routeros/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ func Provider() *schema.Provider {
* API: api[s]://host[:port]
* api://router.local
* apis://router.local:8729
* REST: https://host
* REST: http[s]://host
* http://router.local
* https://router.local
* router.local
* 127.0.0.1
Expand Down
1 change: 1 addition & 0 deletions templates/index.md.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ To get started with the provider, you first need to enable the REST API on your
### Required

- `hosturl` (String) URL of the ROS router. Include including the scheme:
- `http` new REST API
- `https` new REST API with TLS/SSL
- `api` old API without TLS/SSL on port 8728
- `apis` old API with TLS/SSL 8729
Expand Down

0 comments on commit c326052

Please sign in to comment.