-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add user manager advanced settings resource
- Loading branch information
Showing
4 changed files
with
89 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
terraform import routeros_user_manager_advanced.settings . |
4 changes: 4 additions & 0 deletions
4
examples/resources/routeros_user_manager_advanced/resource.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
resource "routeros_user_manager_advanced" "settings" { | ||
web_private_password = "password" | ||
web_private_username = "admin" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
package routeros | ||
|
||
import ( | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" | ||
) | ||
|
||
/* | ||
{ | ||
"paypal-allow": "false", | ||
"paypal-currency": "USD", | ||
"paypal-password": "", | ||
"paypal-signature": "", | ||
"paypal-use-sandbox": "false", | ||
"paypal-user": "", | ||
"web-private-password": "", | ||
"web-private-username": "" | ||
} | ||
*/ | ||
|
||
// https://help.mikrotik.com/docs/display/ROS/User+Manager#UserManager-Advanced | ||
func ResourceUserManagerAdvanced() *schema.Resource { | ||
resSchema := map[string]*schema.Schema{ | ||
MetaResourcePath: PropResourcePath("/user-manager/advanced"), | ||
MetaId: PropId(Id), | ||
|
||
"paypal_allow": { | ||
Type: schema.TypeBool, | ||
Optional: true, | ||
Default: false, | ||
Description: "An option whether to enable PayPal functionality for User Manager.", | ||
}, | ||
"paypal_currency": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Default: "USD", | ||
Description: "The currency related to price setting in which users will be billed.", | ||
}, | ||
"paypal_password": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Description: "The password of the PayPal API account.", | ||
}, | ||
"paypal_signature": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Description: "The signature of the PayPal API account.", | ||
}, | ||
"paypal_use_sandbox": { | ||
Type: schema.TypeBool, | ||
Optional: true, | ||
Default: false, | ||
Description: "An option whether to use PayPal's sandbox environment for testing purposes.", | ||
}, | ||
"paypal_user": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Description: "The username of the PayPal API account.", | ||
}, | ||
"web_private_password": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Description: "The password for accessing `/um/PRIVATE/` section over HTTP.", | ||
}, | ||
"web_private_username": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Description: "The username for accessing `/um/PRIVATE/` section over HTTP.", | ||
}, | ||
} | ||
|
||
return &schema.Resource{ | ||
CreateContext: DefaultSystemCreate(resSchema), | ||
ReadContext: DefaultSystemRead(resSchema), | ||
UpdateContext: DefaultSystemUpdate(resSchema), | ||
DeleteContext: DefaultSystemDelete(resSchema), | ||
|
||
Importer: &schema.ResourceImporter{ | ||
StateContext: schema.ImportStatePassthroughContext, | ||
}, | ||
|
||
Schema: resSchema, | ||
} | ||
} |