diff --git a/docs/resources/ipv6_dhcp_client.md b/docs/resources/ipv6_dhcp_client.md index eeca8732..ef12f7c4 100644 --- a/docs/resources/ipv6_dhcp_client.md +++ b/docs/resources/ipv6_dhcp_client.md @@ -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 @@ -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. @@ -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" +``` diff --git a/examples/resources/routeros_ipv6_dhcp_client/import.sh b/examples/resources/routeros_ipv6_dhcp_client/import.sh new file mode 100644 index 00000000..fa3ff08a --- /dev/null +++ b/examples/resources/routeros_ipv6_dhcp_client/import.sh @@ -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" \ No newline at end of file diff --git a/examples/resources/routeros_ipv6_dhcp_client/resource.tf b/examples/resources/routeros_ipv6_dhcp_client/resource.tf new file mode 100644 index 00000000..59aa0f86 --- /dev/null +++ b/examples/resources/routeros_ipv6_dhcp_client/resource.tf @@ -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 +} diff --git a/routeros/resource_ipv6_dhcp_client.go b/routeros/resource_ipv6_dhcp_client.go index e305b47a..9eb24e5b 100644 --- a/routeros/resource_ipv6_dhcp_client.go +++ b/routeros/resource_ipv6_dhcp_client.go @@ -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.",