Skip to content

Commit a3a5272

Browse files
committed
Exposes broadcast and multicast settings on Network
There was a few settings on the network that are exposed on the ZeroTier Central UI which were not available on the provider. This commit includes those extra fields, where one of them are not documented but available on the UI.
1 parent d577564 commit a3a5272

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

zerotier/client.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ type V4AssignModeConfig struct {
3535
type Config struct {
3636
Name string `json:"name"`
3737
Private bool `json:"private"`
38+
EnableBroadcast bool `json:"enableBroadcast"`
39+
MulticastLimit int `json:"multicastLimit"`
3840
Routes []Route `json:"routes"`
3941
IpAssignmentPools []IpRange `json:"ipAssignmentPools"`
4042
V4AssignMode V4AssignModeConfig `json:"v4AssignMode"`

zerotier/resource_zerotier_network.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88

99
"github.com/hashicorp/terraform/helper/hashcode"
1010
"github.com/hashicorp/terraform/helper/schema"
11+
"github.com/hashicorp/terraform/helper/validation"
1112
)
1213

1314
func route() *schema.Resource {
@@ -62,6 +63,20 @@ func resourceZeroTierNetwork() *schema.Resource {
6263
Optional: true,
6364
Default: true,
6465
},
66+
//Warning: Undecoumented on the API, but that is how the UI manages it
67+
"broadcast": &schema.Schema{
68+
Type: schema.TypeBool,
69+
Description: "Enable network broadcast (ff:ff:ff:ff:ff:ff)",
70+
Optional: true,
71+
Default: true,
72+
},
73+
"multicast_limit": &schema.Schema{
74+
Type: schema.TypeInt,
75+
Description: "The maximum number of recipients that can receive an Ethernet multicast or broadcast. Setting to 0 disables multicast, but be aware that only IPv6 with NDP emulation (RFC4193 or 6PLANE addressing modes) or other unicast-only protocols will work without multicast.",
76+
Optional: true,
77+
Default: 32,
78+
ValidateFunc: validation.IntAtLeast(0),
79+
},
6580
"route": &schema.Schema{
6681
Type: schema.TypeList,
6782
Optional: true,
@@ -144,6 +159,8 @@ func fromResourceData(d *schema.ResourceData) (*Network, error) {
144159
Config: &Config{
145160
Name: d.Get("name").(string),
146161
Private: d.Get("private").(bool),
162+
EnableBroadcast: d.Get("broadcast").(bool),
163+
MulticastLimit: d.Get("multicast_limit").(int),
147164
V4AssignMode: V4AssignModeConfig{ZT: true},
148165
Routes: routes,
149166
IpAssignmentPools: pools,
@@ -186,6 +203,8 @@ func resourceNetworkRead(d *schema.ResourceData, m interface{}) error {
186203
d.Set("name", net.Config.Name)
187204
d.Set("description", net.Description)
188205
d.Set("private", net.Config.Private)
206+
d.Set("broadcast", net.Config.EnableBroadcast)
207+
d.Set("multicast_limit", net.Config.MulticastLimit)
189208
d.Set("auto_assign_v4", net.Config.V4AssignMode.ZT)
190209
d.Set("rules_source", net.RulesSource)
191210

0 commit comments

Comments
 (0)