-
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.
fix(dhcp_server): Add Name-Id migration
- Loading branch information
Showing
3 changed files
with
148 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 DHCP server in case of the example use bridge_dhcp | ||
terraform import routeros_ip_dhcp_server.server bridge_dhcp | ||
#The ID can be found via API or the terminal | ||
#The command for the terminal is -> :put [/ip/dhcp-server get [print show-ids]] | ||
terraform import routeros_ip_dhcp_server.server "*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,135 @@ | ||
package routeros | ||
|
||
import ( | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" | ||
) | ||
|
||
func ResourceDhcpServerV0() *schema.Resource { | ||
return &schema.Resource{ | ||
Schema: map[string]*schema.Schema{ | ||
MetaResourcePath: PropResourcePath("/ip/dhcp-server"), | ||
MetaId: PropId(Name), | ||
|
||
"add_arp": { | ||
Type: schema.TypeBool, | ||
Optional: true, | ||
Description: "Whether to add dynamic ARP entry. ", | ||
}, | ||
"address_pool": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Default: "static-only", | ||
Description: "IP pool, from which to take IP addresses for the clients. If set to static-only, then only " + | ||
"the clients that have a static lease (added in lease submenu) will be allowed.", | ||
}, | ||
"allow_dual_stack_queue": { | ||
Type: schema.TypeBool, | ||
Optional: true, | ||
Description: "Creates a single simple queue entry for both IPv4 and IPv6 addresses, uses the MAC address and " + | ||
"DUID for identification. Requires IPv6 DHCP Server to have this option enabled as well to work properly.", | ||
}, | ||
"always_broadcast": { | ||
Type: schema.TypeBool, | ||
Optional: true, | ||
Description: "Always send replies as broadcasts even if destination IP is known.", | ||
}, | ||
"authoritative": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Default: "yes", | ||
Description: "Option changes the way how a server responds to DHCP requests.", | ||
ValidateFunc: validation.StringInSlice([]string{"after-10sec-delay", "after-2sec-delay", "yes", "no"}, false), | ||
}, | ||
"bootp_lease_time": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Description: "Accepts two predefined options or time value: * forever - lease never expires " + | ||
"* lease-time - use time from lease-time parameter", | ||
}, | ||
"bootp_support": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Default: "static", | ||
Description: "Support for BOOTP clients.", | ||
ValidateFunc: validation.StringInSlice([]string{"none", "static", "dynamic"}, false), | ||
}, | ||
"client_mac_limit": { | ||
Type: schema.TypeInt, | ||
Optional: true, | ||
Description: "Specifies whether to limit specific number of clients per single MAC address.", | ||
}, | ||
"conflict_detection": { | ||
Type: schema.TypeBool, | ||
Optional: true, | ||
Description: "Allows to disable/enable conflict detection. If option is enabled, then whenever server tries " + | ||
"to assign a lease it will send ICMP and ARP messages to detect whether such address in the network " + | ||
"already exist. If any of above get reply address is considered already used. Conflict detection must " + | ||
"be disabled when any kind of DHCP client limitation per port or per mac is used.", | ||
}, | ||
KeyComment: PropCommentRw, | ||
"delay_threshold": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Description: "If secs field in DHCP packet is smaller than delay-threshold, then this packet is ignored. " + | ||
"If set to none - there is no threshold (all DHCP packets are processed).", | ||
}, | ||
"dhcp_option_set": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Description: "Use custom set of DHCP options defined in option sets menu.", | ||
}, | ||
KeyDisabled: PropDisabledRw, | ||
KeyDynamic: PropDynamicRo, | ||
"insert_queue_before": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Description: "Specify where to place dynamic simple queue entries for static DCHP leases with rate-limit parameter set.", | ||
}, | ||
KeyInterface: PropInterfaceRw, | ||
KeyInvalid: PropInvalidRo, | ||
"lease_script": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Description: "A script that will be executed after a lease is assigned or de-assigned.", | ||
}, | ||
"lease_time": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Default: "10m", | ||
Description: "The time that a client may use the assigned address. The client will try to renew this " + | ||
"address after half of this time and will request a new address after the time limit expires.", | ||
}, | ||
KeyName: PropNameForceNewRw, | ||
"parent_queue": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Description: "", | ||
}, | ||
"relay": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Description: "The IP address of the relay this DHCP server.", | ||
ValidateFunc: ValidationIpAddress, | ||
}, | ||
"src_address": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Description: "The address which the DHCP client must send requests to in order to renew an IP address lease.", | ||
ValidateFunc: ValidationIpAddress, | ||
}, | ||
"use_framed_as_classless": { | ||
Type: schema.TypeBool, | ||
Optional: true, | ||
Description: "Forward RADIUS Framed-Route as a DHCP Classless-Static-Route to DHCP-client.", | ||
}, | ||
"use_radius": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Default: "no", | ||
Description: "Whether to use RADIUS server.", | ||
ValidateFunc: validation.StringInSlice([]string{"yes", "no", "accounting"}, false), | ||
}, | ||
}, | ||
} | ||
} |