Skip to content

Commit 0aa3e92

Browse files
committed
resource(switch_port_settings): register the resource
Registered the existing `oxide_switch_port_settings` resource and added public facing documentation and a changelog entry.
1 parent a59b89c commit 0aa3e92

File tree

3 files changed

+351
-2
lines changed

3 files changed

+351
-2
lines changed

.changelog/0.13.0.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ title = "`oxide_vpc_firewall_rules`"
33
description = "Updated the schema for the `protocols` attribute to allow for more control over ICMP traffic. [#474](https://github.com/oxidecomputer/terraform-provider-oxide/pull/474)"
44

55
[[features]]
6-
title = ""
7-
description = ""
6+
title = "New resource"
7+
description = "`oxide_switch_port_settings` [#475](https://github.com/oxidecomputer/terraform-provider-oxide/pull/475)."
88

99
[[enhancements]]
1010
title = ""
Lines changed: 348 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,348 @@
1+
---
2+
page_title: "oxide_switch_port_settings Resource - terraform-provider-oxide"
3+
---
4+
5+
# oxide_switch_port_settings (Resource)
6+
7+
This resource manages switch port settings to configure network switch ports.
8+
9+
!> Switch port settings defined by this resource are considered exhaustive and
10+
will overwrite any other switch port settings upon apply.
11+
12+
## Example Usage
13+
14+
### Basic Switch Port Settings
15+
16+
```hcl
17+
resource "oxide_switch_port_settings" "example" {
18+
name = "example"
19+
description = "Switch port settings."
20+
port_config = {
21+
geometry = "qsfp28x1"
22+
}
23+
addresses = [
24+
{
25+
link_name = "phy0"
26+
addresses = [
27+
{
28+
address = "192.168.1.123/24"
29+
address_lot_id = "38223e3a-76da-400d-a1e2-8cb4d242095a"
30+
},
31+
]
32+
},
33+
{
34+
link_name = "phy1"
35+
addresses = [
36+
{
37+
address = "10.0.0.123/24"
38+
address_lot_id = "a1ab8634-7973-40f1-966c-7f4a8dad7849"
39+
},
40+
]
41+
},
42+
]
43+
links = [
44+
{
45+
link_name = "phy0"
46+
autoneg = false
47+
mtu = 1500
48+
speed = "speed1_g"
49+
lldp = {
50+
enabled = false
51+
}
52+
},
53+
{
54+
link_name = "phy1"
55+
autoneg = false
56+
mtu = 1500
57+
speed = "speed1_g"
58+
lldp = {
59+
enabled = false
60+
}
61+
},
62+
]
63+
routes = [
64+
{
65+
link_name = "phy0"
66+
routes = [
67+
{
68+
dst = "0.0.0.0/0"
69+
gw = "192.168.1.1"
70+
},
71+
]
72+
},
73+
{
74+
link_name = "phy0"
75+
routes = [
76+
{
77+
dst = "0.0.0.0/0"
78+
gw = "10.0.0.1"
79+
},
80+
]
81+
},
82+
]
83+
}
84+
```
85+
86+
### Switch Port Settings with BGP Peers
87+
88+
```hcl
89+
resource "oxide_switch_port_settings" "example" {
90+
name = "example"
91+
description = "Switch port settings."
92+
port_config = {
93+
geometry = "qsfp28x1"
94+
}
95+
addresses = [
96+
{
97+
link_name = "phy0"
98+
addresses = [
99+
{
100+
address = "192.168.1.123/24"
101+
address_lot_id = "38223e3a-76da-400d-a1e2-8cb4d242095a"
102+
},
103+
]
104+
},
105+
]
106+
bgp_peers = [
107+
{
108+
link_name = "phy0"
109+
peers = [
110+
{
111+
allowed_export = {
112+
type = "no_filtering"
113+
}
114+
allowed_import = {
115+
type = "no_filtering"
116+
}
117+
addr = "1.2.3.4"
118+
bgp_config = "aeeb1e60-b773-432a-b3e9-f677e116ac15"
119+
communities = []
120+
connect_retry = 15
121+
delay_open = 15
122+
enforce_first_as = false
123+
hold_time = 15
124+
idle_hold_time = 15
125+
interface_name = "phy0"
126+
keepalive = 15
127+
}
128+
]
129+
}
130+
]
131+
links = [
132+
{
133+
link_name = "phy0"
134+
autoneg = false
135+
mtu = 1500
136+
speed = "speed1_g"
137+
lldp = {
138+
enabled = false
139+
}
140+
},
141+
]
142+
routes = [
143+
{
144+
link_name = "phy0"
145+
routes = [
146+
{
147+
dst = "0.0.0.0/0"
148+
gw = "192.168.1.1"
149+
},
150+
]
151+
},
152+
]
153+
}
154+
```
155+
156+
157+
## Schema
158+
159+
### Required
160+
161+
- `addresses` (Set of Object) Address configuration for the switch port. See [below for nested schema](#nestedatt--addresses).
162+
- `description` (String) Human-readable description of the switch port settings.
163+
- `links` (Set of Object) Link configuration for the switch port. See [below for nested schema](#nestedatt--links).
164+
- `name` (String) Name of the switch port settings.
165+
- `port_config` (Object) Physical port configuration. See [below for nested schema](#nestedatt--port_config).
166+
167+
### Optional
168+
169+
- `bgp_peers` (Set of Object) BGP peer configuration for the switch port. See [below for nested schema](#nestedatt--bgp_peers).
170+
- `routes` (Set of Object) Static route configuration. See [below for nested schema](#nestedatt--routes).
171+
- `timeouts` (Attribute) Timeouts for performing API operations. See [below for nested schema](#nestedatt--timeouts).
172+
173+
### Read-Only
174+
175+
- `id` (String) Unique, immutable, system-controlled identifier of the switch port settings.
176+
- `time_created` (String) Timestamp of when the switch port settings were created.
177+
- `time_modified` (String) Timestamp of when the switch port settings were last modified.
178+
179+
<a id="nestedatt--addresses"></a>
180+
181+
### Nested Schema for `addresses`
182+
183+
#### Required
184+
185+
- `addresses` (Set of Object) Set of addresses to assign to the link. See [below for nested schema](#nestedatt--addresses--addresses).
186+
- `link_name` (String) Name of the link for the address configuration.
187+
188+
<a id="nestedatt--addresses--addresses"></a>
189+
190+
### Nested Schema for `addresses.addresses`
191+
192+
#### Required
193+
194+
- `address` (String) IPv4 or IPv6 address, including the subnet mask.
195+
- `address_lot_id` (String) Address lot the address is allocated from.
196+
197+
#### Optional
198+
199+
- `vlan_id` (Number) VLAN ID for the address.
200+
201+
<a id="nestedatt--bgp_peers"></a>
202+
203+
### Nested Schema for `bgp_peers`
204+
205+
#### Required
206+
207+
- `link_name` (String) Name of the link for the BGP peer configuration.
208+
- `peers` (Set of Object) Set of BGP peer configuration to assign to the link. See [below for nested schema](#nestedatt--bgp_peers--peers).
209+
210+
<a id="nestedatt--bgp_peers--peers"></a>
211+
212+
### Nested Schema for `bgp_peers.peers`
213+
214+
#### Required
215+
216+
- `address` (String) Address of the host to peer with.
217+
- `allowed_export` (Object) Export policy for the peer. See [below for nested schema](#nestedatt--bgp_peers--peers--allowed_export).
218+
- `allowed_import` (Object) Import policy for the peer. See [below for nested schema](#nestedatt--bgp_peers--peers--allowed_import).
219+
- `bgp_config` (String) Name or ID of the global BGP configuration used for establishing a session with this peer.
220+
- `communities` (Set of Number) BGP communities to apply to this peer's routes.
221+
- `connect_retry` (Number) Number of seconds to wait before retrying a TCP connection.
222+
- `delay_open` (Number) Number of seconds to delay sending an open request after establishing a TCP session.
223+
- `enforce_first_as` (Boolean) Whether to enforce that the first autonomous system in paths received from this peer is the peer's autonomous system.
224+
- `hold_time` (Number) Number of seconds to hold peer connections between keepalives.
225+
- `idle_hold_time` (Number) Number of seconds to hold a peer in idle before attempting a new session.
226+
- `interface_name` (String) Name of the interface to use for this BGP peer session.
227+
- `keepalive` (Number) Number of seconds between sending BGP keepalive requests.
228+
229+
#### Optional
230+
231+
- `local_pref` (Number) BGP local preference value for routes received from this peer.
232+
- `md5_auth_key` (String) MD5 authentication key for this BGP session.
233+
- `min_ttl` (Number) Minimum acceptable TTL for BGP packets from this peer.
234+
- `multi_exit_discriminator` (Number) Multi-exit discriminator (MED) to advertise to this peer.
235+
- `remote_asn` (Number) Remote autonomous system number for this BGP peer.
236+
- `vlan_id` (Number) VLAN ID for this BGP peer session.
237+
238+
<a id="nestedatt--bgp_peers--peers--allowed_export"></a>
239+
240+
### Nested Schema for `bgp_peers.peers.allowed_export`
241+
242+
#### Required
243+
244+
- `type` (String) Type of filter to apply. Valid values are `no_filtering` or `allow`.
245+
246+
#### Optional
247+
248+
- `value` (Set of String) IPv4 or IPv6 address to apply the filter to, including the subnet mask. Only valid when `type` is `allow`.
249+
250+
<a id="nestedatt--bgp_peers--peers--allowed_import"></a>
251+
252+
### Nested Schema for `bgp_peers.peers.allowed_import`
253+
254+
#### Required
255+
256+
- `type` (String) Type of filter to apply. Valid values are `no_filtering` or `allow`.
257+
258+
#### Optional
259+
260+
- `value` (Set of String) IPv4 or IPv6 address to apply the filter to, including the subnet mask. Only valid when `type` is `allow`.
261+
262+
<a id="nestedatt--links"></a>
263+
264+
### Nested Schema for `links`
265+
266+
#### Required
267+
268+
- `autoneg` (Boolean) Whether to enable auto-negotiation for this link.
269+
- `link_name` (String) Name of the link.
270+
- `lldp` (Object) Link Layer Discovery Protocol (LLDP) configuration. See [below for nested schema](#nestedatt--links--lldp).
271+
- `mtu` (Number) Maximum Transmission Unit (MTU) for this link.
272+
- `speed` (String) Link speed. Valid values are `speed0_g`, `speed1_g`, `speed10_g`, `speed25_g`, `speed40_g`, `speed50_g`, `speed100_g`, `speed200_g`, or `speed400_g`.
273+
274+
#### Optional
275+
276+
- `fec` (String) Forward error correction (FEC) type. Valid values are `firecode`, `none`, or `rs`.
277+
- `tx_eq` (Object) Transceiver equalization settings. See [below for nested schema](#nestedatt--links--tx_eq).
278+
279+
<a id="nestedatt--links--lldp"></a>
280+
281+
### Nested Schema for `links.lldp`
282+
283+
#### Required
284+
285+
- `enabled` (Boolean) Whether to enable LLDP on this link.
286+
287+
#### Optional
288+
289+
- `chassis_id` (String) LLDP chassis ID.
290+
- `link_description` (String) LLDP link description.
291+
- `link_name` (String) LLDP link name.
292+
- `management_ip` (String) LLDP management IP address.
293+
- `system_description` (String) LLDP system description.
294+
- `system_name` (String) LLDP system name.
295+
296+
<a id="nestedatt--links--tx_eq"></a>
297+
298+
### Nested Schema for `links.tx_eq`
299+
300+
#### Optional
301+
302+
- `main` (Number) Main tap equalization value.
303+
- `post1` (Number) Post-cursor tap1 equalization value.
304+
- `post2` (Number) Post-cursor tap2 equalization value.
305+
- `pre1` (Number) Pre-cursor tap1 equalization value.
306+
- `pre2` (Number) Pre-cursor tap2 equalization value.
307+
308+
<a id="nestedatt--port_config"></a>
309+
310+
### Nested Schema for `port_config`
311+
312+
#### Required
313+
314+
- `geometry` (String) Port geometry. Valid values are `qsfp28x1`, `qsfp28x2`, or `sfp28x4`.
315+
316+
<a id="nestedatt--routes"></a>
317+
318+
### Nested Schema for `routes`
319+
320+
#### Required
321+
322+
- `link_name` (String) Name of the link for these routes.
323+
- `routes` (Set of Object) Set of static routes for this link. See [below for nested schema](#nestedatt--routes--routes).
324+
325+
<a id="nestedatt--routes--routes"></a>
326+
327+
### Nested Schema for `routes.routes`
328+
329+
#### Required
330+
331+
- `dst` (String) Destination network in CIDR notation.
332+
- `gw` (String) Gateway IP address for this route.
333+
334+
#### Optional
335+
336+
- `rib_priority` (Number) Routing Information Base (RIB) priority for this route.
337+
- `vid` (Number) VLAN ID for this route.
338+
339+
<a id="nestedatt--timeouts"></a>
340+
341+
### Nested Schema for `timeouts`
342+
343+
Optional:
344+
345+
- `create` (String, Default `10m`)
346+
- `delete` (String, Default `10m`)
347+
- `read` (String, Default `10m`)
348+
- `update` (String, Default `10m`)

internal/provider/provider.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,5 +199,6 @@ func (p *oxideProvider) Resources(_ context.Context) []func() resource.Resource
199199
NewVPCSubnetResource,
200200
NewFloatingIPResource,
201201
NewSiloResource,
202+
NewSwitchPortSettingsResource,
202203
}
203204
}

0 commit comments

Comments
 (0)