-
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.
- Loading branch information
Showing
3 changed files
with
53 additions
and
3 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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
# Import with the name of the wireguard interface in case of the example use test_wg_interface | ||
terraform import routeros_interface_wireguard.test_wg_interface test_wg_interface | ||
#The ID can be found via API or the terminal | ||
#The command for the terminal is -> :put [/interface/wireguard get [print show-ids]] | ||
terraform import routeros_interface_wireguard.test_wg_interface "*1" |
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,40 @@ | ||
package routeros | ||
|
||
import ( | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" | ||
) | ||
|
||
func ResourceInterfaceWireguardV0() *schema.Resource { | ||
return &schema.Resource{ | ||
Schema: map[string]*schema.Schema{ | ||
MetaResourcePath: PropResourcePath("/interface/wireguard"), | ||
MetaId: PropId(Name), | ||
|
||
KeyComment: PropCommentRw, | ||
KeyDisabled: PropDisabledRw, | ||
"listen_port": { | ||
Type: schema.TypeInt, | ||
Required: true, | ||
Description: "Port for WireGuard service to listen on for incoming sessions.", | ||
ValidateFunc: validation.IntBetween(1, 65535), | ||
}, | ||
KeyMtu: PropMtuRw(), | ||
KeyName: PropNameForceNewRw, | ||
"private_key": { | ||
Type: schema.TypeString, | ||
Computed: true, | ||
Optional: true, | ||
Sensitive: true, | ||
Description: "A base64 private key. If not specified, it will be automatically " + | ||
"generated upon interface creation.", | ||
}, | ||
"public_key": { | ||
Type: schema.TypeString, | ||
Computed: true, | ||
Description: "A base64 public key is calculated from the private key.", | ||
}, | ||
KeyRunning: PropRunningRo, | ||
}, | ||
} | ||
} |