Skip to content

Commit c5eec72

Browse files
authored
feat: relax edge cluster and asn restrictions (#295)
Relaxed Edge Cluster setting restrictions for Tier0/1 routers and ASNs. Signed-off-by: Stoyan Zhelyazkov <[email protected]>
1 parent 3d46e45 commit c5eec72

File tree

4 files changed

+11
-22
lines changed

4 files changed

+11
-22
lines changed

docs/resources/edge_cluster.md

+7-11
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,10 @@ Review the documentation for VMware Cloud Foundation for more information about
4242
- `profile_type` (String) One among: DEFAULT, CUSTOM. If set to CUSTOM a 'profile' must be provided
4343
- `root_password` (String) Root user password for the NSX manager
4444
- `routing_type` (String) One among: EBGP, STATIC
45-
- `tier0_name` (String) Name for the Tier-0 gateway
4645

4746
### Optional
4847

4948
- `internal_transit_subnets` (List of String) Subnet addresses in CIDR notation that are used to assign addresses to logical links connecting service routers and distributed routers
50-
5149
- `profile` (Block List, Max: 1) The specification for the edge cluster profile (see [below for nested schema](#nestedblock--profile))
5250
- `skip_tep_routability_check` (Boolean) Set to true to bypass normal ICMP-based check of Edge TEP / host TEP routability (default is false, meaning do check)
5351
- `tier1_name` (String) Name for the Tier-1 gateway
@@ -60,7 +58,6 @@ Review the documentation for VMware Cloud Foundation for more information about
6058
- `id` (String) The ID of this resource.
6159

6260
<a id="nestedblock--edge_node"></a>
63-
6461
### Nested Schema for `edge_node`
6562

6663
Required:
@@ -79,25 +76,23 @@ Required:
7976

8077
Optional:
8178

82-
- `compute_cluster_id` (String) The id of the compute cluster. You cannot specify a value for `compute_cluster_name` if you set this attribute.
83-
- `compute_cluster_name` (String) The name of the compute cluster. You cannot specify a value for `compute_cluster_id` if you set this attribute.
84-
79+
- `compute_cluster_id` (String) The id of the compute cluster
80+
- `compute_cluster_name` (String) The name of the compute cluster
8581
- `first_nsx_vds_uplink` (String) The name of the first NSX-enabled VDS uplink
8682
- `management_network` (Block List, Max: 1) The management network which will be created for this node (see [below for nested schema](#nestedblock--edge_node--management_network))
8783
- `second_nsx_vds_uplink` (String) The name of the second NSX-enabled VDS uplink
8884
- `uplink` (Block List) Specifications of Tier-0 uplinks for the edge node (see [below for nested schema](#nestedblock--edge_node--uplink))
8985

9086
<a id="nestedblock--edge_node--management_network"></a>
91-
9287
### Nested Schema for `edge_node.management_network`
9388

9489
Required:
9590

9691
- `portgroup_name` (String) The name of the portgroup
9792
- `vlan_id` (Number) The VLAN ID for the portgroup
9893

99-
<a id="nestedblock--edge_node--uplink"></a>
10094

95+
<a id="nestedblock--edge_node--uplink"></a>
10196
### Nested Schema for `edge_node.uplink`
10297

10398
Required:
@@ -107,7 +102,6 @@ Required:
107102
- `vlan` (Number) The VLAN ID for the distributed switch uplink
108103

109104
<a id="nestedblock--edge_node--uplink--bgp_peer"></a>
110-
111105
### Nested Schema for `edge_node.uplink.bgp_peer`
112106

113107
Required:
@@ -116,8 +110,10 @@ Required:
116110
- `ip` (String) IP address
117111
- `password` (String) Password
118112

119-
<a id="nestedblock--profile"></a>
120113

114+
115+
116+
<a id="nestedblock--profile"></a>
121117
### Nested Schema for `profile`
122118

123119
Required:
@@ -128,8 +124,8 @@ Required:
128124
- `name` (String) The name of the profile
129125
- `standby_relocation_threshold` (Number) Standby relocation threshold
130126

131-
<a id="nestedblock--timeouts"></a>
132127

128+
<a id="nestedblock--timeouts"></a>
133129
### Nested Schema for `timeouts`
134130

135131
Optional:

internal/provider/resource_edge_cluster.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ func ResourceEdgeCluster() *schema.Resource {
6565
},
6666
"tier0_name": {
6767
Type: schema.TypeString,
68-
Required: true,
68+
Optional: true,
6969
Description: "Name for the Tier-0 gateway",
7070
ValidateFunc: validation.NoZeroValues,
7171
},

internal/provider/resource_edge_cluster_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,6 @@ func getEdgeClusterConfigFullInitial() string {
7575
root_password = %q
7676
admin_password = %q
7777
audit_password = %q
78-
tier0_name = "T0_testCluster1"
79-
tier1_name = "T1_testCluster1"
8078
form_factor = "MEDIUM"
8179
profile_type = "DEFAULT"
8280
routing_type = "EBGP"

internal/validation/validation_utils.go

+3-8
Original file line numberDiff line numberDiff line change
@@ -315,20 +315,15 @@ func IsEmpty(object interface{}) bool {
315315
}
316316

317317
func ValidASN(v interface{}, k string) (ws []string, errors []error) {
318-
value := v.(string)
319-
320-
asn, err := strconv.ParseInt(value, 10, 64)
318+
asn, err := strconv.ParseInt(v.(string), 10, 64)
321319
if err != nil {
322320
errors = append(errors, fmt.Errorf("%q (%q) must be a 64-bit integer", k, v))
323321
return
324322
}
325323

326-
isLegacyAsn := func(a int64) bool {
327-
return a == 7224 || a == 9059 || a == 10124 || a == 17493
324+
if asn < 1 || asn > 4294967294 {
325+
errors = append(errors, fmt.Errorf("%q (%q) must be in the range 1 to 4294967294", k, v))
328326
}
329327

330-
if !isLegacyAsn(asn) && ((asn < 64512) || (asn > 65534 && asn < 4200000000) || (asn > 4294967294)) {
331-
errors = append(errors, fmt.Errorf("%q (%q) must be 7224, 9059, 10124 or 17493 or in the range 64512 to 65534 or 4200000000 to 4294967294", k, v))
332-
}
333328
return
334329
}

0 commit comments

Comments
 (0)