Skip to content

Commit 1bf76b9

Browse files
committed
resource(switch_port_settings): remove unused attributes
1 parent 0cb7cb0 commit 1bf76b9

File tree

4 files changed

+5
-140
lines changed

4 files changed

+5
-140
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ require (
1111
github.com/hashicorp/terraform-plugin-log v0.9.0
1212
github.com/hashicorp/terraform-plugin-sdk/v2 v2.37.0
1313
github.com/hashicorp/terraform-plugin-testing v1.13.2
14-
github.com/oxidecomputer/oxide.go v0.5.1-0.20250721184220-01e729a38434
14+
github.com/oxidecomputer/oxide.go v0.5.1-0.20250721231911-34f457098cbb
1515
github.com/stretchr/testify v1.10.0
1616
)
1717

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@ github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zx
136136
github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
137137
github.com/oklog/run v1.0.0 h1:Ru7dDtJNOyC66gQ5dQmaCa0qIsAUFY3sFpK1Xk8igrw=
138138
github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA=
139-
github.com/oxidecomputer/oxide.go v0.5.1-0.20250721184220-01e729a38434 h1:m5PJ1CyZsQ/85VsuooZd7QGIMvjPpu/atA3+vThDhbs=
140-
github.com/oxidecomputer/oxide.go v0.5.1-0.20250721184220-01e729a38434/go.mod h1:4gfHlxdBQLs/34UbChPvINd+pGNAnGlASRGEd4xIz1Y=
139+
github.com/oxidecomputer/oxide.go v0.5.1-0.20250721231911-34f457098cbb h1:5X/J81LYoezL6GRj5k3YhaPgv8tX5jx6My5ea+CCGtk=
140+
github.com/oxidecomputer/oxide.go v0.5.1-0.20250721231911-34f457098cbb/go.mod h1:4gfHlxdBQLs/34UbChPvINd+pGNAnGlASRGEd4xIz1Y=
141141
github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8=
142142
github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c=
143143
github.com/pjbgf/sha1cd v0.3.2 h1:a9wb0bp1oC2TGwStyn0Umc/IGKQnEgF0vVaZ8QF8eo4=

internal/provider/resource_switch_port_settings.go

Lines changed: 2 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ type switchPortSettingsModel struct {
3535
Description types.String `tfsdk:"description"`
3636
Addresses []switchPortSettingsAddressModel `tfsdk:"addresses"`
3737
BGPPeers []switchPortSettingsBGPPeerModel `tfsdk:"bgp_peers"`
38-
Groups []types.String `tfsdk:"groups"`
39-
Interfaces []switchPortSettingsInterfaceModel `tfsdk:"interfaces"`
4038
Links []switchPortSettingsLinkModel `tfsdk:"links"`
4139
PortConfig *switchPortSettingsPortConfigModel `tfsdk:"port_config"`
4240
Routes []switchPortSettingsRouteModel `tfsdk:"routes"`
@@ -92,17 +90,6 @@ type switchPortSettingsBGPPeerPeerAllowedImportModel struct {
9290
Value []types.String `tfsdk:"value"`
9391
}
9492

95-
type switchPortSettingsInterfaceModel struct {
96-
Kind *switchPortSettingsInterfaceKindModel `tfsdk:"kind"`
97-
LinkName types.String `tfsdk:"link_name"`
98-
V6Enabled types.Bool `tfsdk:"v6_enabled"`
99-
}
100-
101-
type switchPortSettingsInterfaceKindModel struct {
102-
Type types.String `tfsdk:"type"`
103-
VID types.Int32 `tfsdk:"vid"`
104-
}
105-
10693
type switchPortSettingsLinkModel struct {
10794
Autoneg types.Bool `tfsdk:"autoneg"`
10895
FEC types.String `tfsdk:"fec"`
@@ -342,48 +329,6 @@ func (r *switchPortSettingsResource) Schema(ctx context.Context, _ resource.Sche
342329
Required: true,
343330
Description: "Human-readable description of the switch port settings.",
344331
},
345-
"groups": schema.SetAttribute{
346-
Optional: true,
347-
ElementType: types.StringType,
348-
Description: "Set of port settings group IDs to include in these settings.",
349-
},
350-
"interfaces": schema.SetNestedAttribute{
351-
Optional: true,
352-
Description: "Interface configuration for the switch port.",
353-
NestedObject: schema.NestedAttributeObject{
354-
Attributes: map[string]schema.Attribute{
355-
"kind": schema.SingleNestedAttribute{
356-
Required: true,
357-
Description: "The kind of interface this configuration represents.",
358-
Attributes: map[string]schema.Attribute{
359-
"type": schema.StringAttribute{
360-
Required: true,
361-
Description: "Type of the interface.",
362-
Validators: []validator.String{
363-
stringvalidator.OneOf(
364-
string(oxide.SwitchInterfaceKindTypePrimary),
365-
string(oxide.SwitchInterfaceKindTypeVlan),
366-
string(oxide.SwitchInterfaceKindTypeLoopback),
367-
),
368-
},
369-
},
370-
"vid": schema.Int32Attribute{
371-
Optional: true,
372-
Description: "VLAN ID for the interfaces.",
373-
},
374-
},
375-
},
376-
"link_name": schema.StringAttribute{
377-
Required: true,
378-
Description: "Name of the link this interface is associated with.",
379-
},
380-
"v6_enabled": schema.BoolAttribute{
381-
Optional: true,
382-
Description: "Enable IPv6 on this interface.",
383-
},
384-
},
385-
},
386-
},
387332
"links": schema.SetNestedAttribute{
388333
Required: true,
389334
Description: "Link configuration for the switch port.",
@@ -664,8 +609,6 @@ func (r *switchPortSettingsResource) Read(ctx context.Context, req resource.Read
664609
// types.
665610
state.Addresses = model.Addresses
666611
state.BGPPeers = model.BGPPeers
667-
state.Groups = model.Groups
668-
state.Interfaces = model.Interfaces
669612
state.Links = model.Links
670613
state.PortConfig = model.PortConfig
671614
state.Routes = model.Routes
@@ -965,36 +908,6 @@ func toSwitchPortSettingsModel(settings *oxide.SwitchPortSettings) (switchPortSe
965908
model.BGPPeers = bgpPeersModels
966909
}
967910

968-
//
969-
// Groups
970-
//
971-
if len(settings.Groups) > 0 {
972-
groupModels := make([]types.String, 0)
973-
for _, group := range settings.Groups {
974-
groupModel := types.StringValue(group.PortSettingsGroupId)
975-
groupModels = append(groupModels, groupModel)
976-
}
977-
model.Groups = groupModels
978-
}
979-
980-
//
981-
// Interfaces
982-
//
983-
if len(settings.Interfaces) > 0 {
984-
interfaceModels := make([]switchPortSettingsInterfaceModel, 0)
985-
for _, iface := range settings.Interfaces {
986-
interfaceModel := switchPortSettingsInterfaceModel{
987-
Kind: &switchPortSettingsInterfaceKindModel{
988-
Type: types.StringValue(string(iface.Kind)),
989-
},
990-
LinkName: types.StringValue(string(iface.InterfaceName)),
991-
V6Enabled: types.BoolPointerValue(iface.V6Enabled),
992-
}
993-
interfaceModels = append(interfaceModels, interfaceModel)
994-
}
995-
model.Interfaces = interfaceModels
996-
}
997-
998911
//
999912
// Links
1000913
//
@@ -1174,6 +1087,8 @@ func toNetworkingSwitchPortSettingsCreateParams(model switchPortSettingsModel) (
11741087
PortConfig: oxide.SwitchPortConfigCreate{
11751088
Geometry: oxide.SwitchPortGeometry(model.PortConfig.Geometry.ValueString()),
11761089
},
1090+
Groups: []oxide.NameOrId{},
1091+
Interfaces: []oxide.SwitchInterfaceConfigCreate{},
11771092
},
11781093
}
11791094

@@ -1309,38 +1224,6 @@ func toNetworkingSwitchPortSettingsCreateParams(model switchPortSettingsModel) (
13091224
}
13101225
params.Body.BgpPeers = bgpPeerConfigs
13111226

1312-
//
1313-
// Groups
1314-
//
1315-
groups := make([]oxide.NameOrId, 0)
1316-
for _, group := range model.Groups {
1317-
groups = append(groups, oxide.NameOrId(group.ValueString()))
1318-
}
1319-
params.Body.Groups = groups
1320-
1321-
//
1322-
// Interfaces
1323-
//
1324-
interfaceConfigs := make([]oxide.SwitchInterfaceConfigCreate, 0)
1325-
for _, interfaceModel := range model.Interfaces {
1326-
interfaceConfig := oxide.SwitchInterfaceConfigCreate{
1327-
Kind: oxide.SwitchInterfaceKind{
1328-
Type: oxide.SwitchInterfaceKindType(interfaceModel.Kind.Type.ValueString()),
1329-
Vid: func() *int {
1330-
if interfaceModel.Kind.VID.IsNull() {
1331-
return nil
1332-
}
1333-
return oxide.NewPointer(int(interfaceModel.Kind.VID.ValueInt32()))
1334-
}(),
1335-
},
1336-
LinkName: oxide.Name(interfaceModel.LinkName.ValueString()),
1337-
V6Enabled: oxide.NewPointer(interfaceModel.V6Enabled.ValueBool()),
1338-
}
1339-
1340-
interfaceConfigs = append(interfaceConfigs, interfaceConfig)
1341-
}
1342-
params.Body.Interfaces = interfaceConfigs
1343-
13441227
//
13451228
// Links
13461229
//

internal/provider/resource_switch_port_settings_test.go

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -68,16 +68,6 @@ resource "oxide_switch_port_settings" "{{.BlockName}}" {
6868
},
6969
]
7070
71-
interfaces = [
72-
{
73-
link_name = "phy0"
74-
kind = {
75-
type = "primary"
76-
}
77-
v6_enabled = false
78-
}
79-
]
80-
8171
links = [
8272
{
8373
link_name = "phy0"
@@ -219,7 +209,6 @@ func checkResourceSwitchPortSettings(resourceName string, name string) resource.
219209
resource.TestCheckResourceAttr(resourceName, "description", "Terraform acceptance testing."),
220210
resource.TestCheckResourceAttr(resourceName, "port_config.geometry", "qsfp28x1"),
221211
resource.TestCheckNoResourceAttr(resourceName, "bgp_peers"),
222-
resource.TestCheckNoResourceAttr(resourceName, "groups"),
223212
resource.TestCheckResourceAttrSet(resourceName, "time_created"),
224213
resource.TestCheckResourceAttrSet(resourceName, "time_modified"),
225214

@@ -230,11 +219,6 @@ func checkResourceSwitchPortSettings(resourceName string, name string) resource.
230219
resource.TestCheckResourceAttrSet(resourceName, "addresses.0.addresses.0.address_lot_id"),
231220
resource.TestCheckNoResourceAttr(resourceName, "addresses.0.addresses.0.vlan_id"),
232221

233-
resource.TestCheckResourceAttr(resourceName, "interfaces.#", "1"),
234-
resource.TestCheckResourceAttr(resourceName, "interfaces.0.link_name", "phy0"),
235-
resource.TestCheckResourceAttr(resourceName, "interfaces.0.kind.type", "primary"),
236-
resource.TestCheckResourceAttr(resourceName, "interfaces.0.v6_enabled", "false"),
237-
238222
resource.TestCheckResourceAttr(resourceName, "links.#", "1"),
239223
resource.TestCheckResourceAttr(resourceName, "links.0.link_name", "phy0"),
240224
resource.TestCheckResourceAttr(resourceName, "links.0.autoneg", "false"),
@@ -267,8 +251,6 @@ func checkResourceSwitchPortSettingsUpdate(resourceName string, name string) res
267251
resource.TestCheckResourceAttr(resourceName, "description", "Terraform acceptance testing (updated)."),
268252
resource.TestCheckResourceAttr(resourceName, "port_config.geometry", "qsfp28x1"),
269253
resource.TestCheckNoResourceAttr(resourceName, "bgp_peers"),
270-
resource.TestCheckNoResourceAttr(resourceName, "groups"),
271-
resource.TestCheckNoResourceAttr(resourceName, "interfaces"),
272254
resource.TestCheckResourceAttrSet(resourceName, "time_created"),
273255
resource.TestCheckResourceAttrSet(resourceName, "time_modified"),
274256

0 commit comments

Comments
 (0)