Skip to content

Commit 3c0e98e

Browse files
authored
chore(lb): set deprecated pn config fields to computed (#3202)
1 parent 40022f0 commit 3c0e98e

File tree

3 files changed

+1
-30
lines changed

3 files changed

+1
-30
lines changed

docs/resources/lb.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,6 @@ The following arguments are supported:
109109
- `private_network_id` - (Required) The ID of the Private Network to attach to.
110110
- ~> **Important:** Updates to `private_network` will recreate the attachment.
111111
- `ipam_ids` - (Optional) IPAM ID of a pre-reserved IP address to assign to the Load Balancer on this Private Network.
112-
- `dhcp_config` - (Deprecated) Please use `ipam_ids`. Set to `true` if you want to let DHCP assign IP addresses.
113-
- `static_config` - (Deprecated) Please use `ipam_ids`. Define a local ip address of your choice for the load balancer instance.
114112
- `ssl_compatibility_level` - (Optional) Enforces minimal SSL version (in SSL/TLS offloading context). Please check [possible values](https://www.scaleway.com/en/developers/api/load-balancer/zoned-api/#path-load-balancer-create-a-load-balancer).
115113
- `zone` - (Defaults to [provider](../index.md#zone) `zone`) The [zone](../guides/regions_and_zones.md#zones) of the Load Balancer.
116114
- `project_id` - (Defaults to [provider](../index.md#project_id) `project_id`) The ID of the Project the Load Balancer is associated with.

internal/services/lb/lb.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,18 +131,16 @@ func ResourceLb() *schema.Resource {
131131
"static_config": {
132132
Description: "Define an IP address in the subnet of your private network that will be assigned to your load balancer instance",
133133
Type: schema.TypeList,
134-
Optional: true,
134+
Computed: true,
135135
Deprecated: "static_config field is deprecated, please use `private_network_id` or `ipam_ids` instead",
136136
Elem: &schema.Schema{
137137
Type: schema.TypeString,
138138
ValidateDiagFunc: verify.IsStandaloneIPorCIDR(),
139139
},
140-
MaxItems: 1,
141140
},
142141
"dhcp_config": {
143142
Description: "Set to true if you want to let DHCP assign IP addresses",
144143
Type: schema.TypeBool,
145-
Optional: true,
146144
Computed: true,
147145
Deprecated: "dhcp_config field is deprecated, please use `private_network_id` or `ipam_ids` instead",
148146
},

internal/services/lb/types.go

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -400,13 +400,6 @@ func expandPrivateNetworks(data any) ([]*lb.PrivateNetwork, error) {
400400
rawPn := pn.(map[string]any)
401401
privateNetwork := &lb.PrivateNetwork{}
402402
privateNetwork.PrivateNetworkID = locality.ExpandID(rawPn["private_network_id"].(string))
403-
404-
if staticConfig, hasStaticConfig := rawPn["static_config"]; hasStaticConfig && len(staticConfig.([]any)) > 0 {
405-
privateNetwork.StaticConfig = expandLbPrivateNetworkStaticConfig(staticConfig) //nolint:staticcheck
406-
} else {
407-
privateNetwork.DHCPConfig = expandLbPrivateNetworkDHCPConfig(rawPn["dhcp_config"]) //nolint:staticcheck
408-
}
409-
410403
privateNetwork.IpamIDs = locality.ExpandIDs(rawPn["ipam_ids"])
411404

412405
pns = append(pns, privateNetwork)
@@ -415,16 +408,6 @@ func expandPrivateNetworks(data any) ([]*lb.PrivateNetwork, error) {
415408
return pns, nil
416409
}
417410

418-
func expandLbPrivateNetworkStaticConfig(raw any) *lb.PrivateNetworkStaticConfig {
419-
if raw == nil || len(raw.([]any)) < 1 {
420-
return nil
421-
}
422-
423-
return &lb.PrivateNetworkStaticConfig{
424-
IPAddress: types.ExpandStringsPtr(raw),
425-
}
426-
}
427-
428411
func flattenLbPrivateNetworkStaticConfig(cfg *lb.PrivateNetworkStaticConfig) []string {
429412
if cfg == nil {
430413
return nil
@@ -433,14 +416,6 @@ func flattenLbPrivateNetworkStaticConfig(cfg *lb.PrivateNetworkStaticConfig) []s
433416
return *cfg.IPAddress //nolint:staticcheck
434417
}
435418

436-
func expandLbPrivateNetworkDHCPConfig(raw any) *lb.PrivateNetworkDHCPConfig {
437-
if raw == nil || !raw.(bool) {
438-
return nil
439-
}
440-
441-
return &lb.PrivateNetworkDHCPConfig{}
442-
}
443-
444419
func attachLBPrivateNetworks(ctx context.Context, lbAPI *lb.ZonedAPI, zone scw.Zone, pnConfigs []*lb.PrivateNetwork, lbID string, timeout time.Duration) ([]*lb.PrivateNetwork, error) {
445420
var privateNetworks []*lb.PrivateNetwork
446421

0 commit comments

Comments
 (0)