Skip to content

Commit

Permalink
Add example
Browse files Browse the repository at this point in the history
  • Loading branch information
jlpedrosa committed Feb 12, 2024
1 parent 33e37b6 commit 4d18415
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 4 deletions.
22 changes: 19 additions & 3 deletions docs/resources/ipv6_dhcp_client.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
# routeros_ipv6_dhcp_client (Resource)



## Example Usage
```terraform
resource "routeros_ipv6_dhcp_client" "inet_provider" {
pool_name = "pub-add-pool"
interface = "ether1"
add-default-route = true
pool_prefix_length = 64
request = ["prefix"]
disabled = false
}
```

<!-- schema generated by tfplugindocs -->
## Schema
Expand All @@ -14,7 +24,7 @@

### Optional

- `add-default-route ` (Boolean) Whether to add default IPv6 route after a client connects.
- `add-default-route` (Boolean) Whether to add default IPv6 route after a client connects.
- `comment` (String)
- `disabled` (Boolean)
- `prefix_hint ` (Number) Include a preferred prefix length.
Expand All @@ -29,4 +39,10 @@
- `request` (List of String) To choose if the DHCPv6 request will ask for the address or the IPv6 prefix, or both.
- `status` (String) Shows the status of DHCPv6 Client:stopped - dhcpv6 client is stoppedsearching - sending "solicit" and trying to get "advertise" Shows actual (resolved) gateway and interface that will be used for packet forwarding.requesting - sent "request" waiting for "reply"bound - received "reply". Prefix assigned. renewing - sent "renew", waiting for "reply" rebinding - sent "rebind", waiting for "reply" error - reply was not received in time or some other error occurred. stopping - sent "release"


## Import
Import is supported using the following syntax:
```shell
#The ID can be found via API or the terminal
#The command for the terminal is -> :put [/ipv6/dhcp-client/ get [print show-ids]]
terraform import routeros_ipv6_dhcp_client.inet_provider "*1"
```
3 changes: 3 additions & 0 deletions examples/resources/routeros_ipv6_dhcp_client/import.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#The ID can be found via API or the terminal
#The command for the terminal is -> :put [/ipv6/dhcp-client/ get [print show-ids]]
terraform import routeros_ipv6_dhcp_client.inet_provider "*1"
8 changes: 8 additions & 0 deletions examples/resources/routeros_ipv6_dhcp_client/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
resource "routeros_ipv6_dhcp_client" "inet_provider" {
pool_name = "pub-add-pool"
interface = "ether1"
add-default-route = true
pool_prefix_length = 64
request = ["prefix"]
disabled = false
}
24 changes: 23 additions & 1 deletion routeros/resource_ipv6_dhcp_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,35 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
)

/*
[
{
".id": "*1",
"add-default-route": "false",
"dhcp-options": "",
"dhcp-server-v6": "fe80::",
"disabled": "false",
"duid": "0x000003434343443",
"interface": "if-name",
"invalid": "false",
"pool-name": "blacknight-pub-addr",
"pool-prefix-length": "64",
"prefix": "2a01:----:/56, 6d16h56m8s",
"prefix-hint": "::/0",
"request": "prefix",
"status": "bound",
"use-peer-dns": "true"
}
]
*/

// ResourceIPv6DhcpClient https://help.mikrotik.com/docs/display/ROS/DHCP#DHCP-DHCPv6Client
func ResourceIPv6DhcpClient() *schema.Resource {
resSchema := map[string]*schema.Schema{
MetaResourcePath: PropResourcePath("/ipv6/dhcp-client/"),
MetaId: PropId(Id),

"add-default-route ": {
"add-default-route": {
Type: schema.TypeBool,
Optional: true,
Description: "Whether to add default IPv6 route after a client connects.",
Expand Down

0 comments on commit 4d18415

Please sign in to comment.