Skip to content

Commit 8a76449

Browse files
committed
finish most TODOs and clean up commented lines
1 parent 795feab commit 8a76449

File tree

2 files changed

+8
-32
lines changed

2 files changed

+8
-32
lines changed

internal/services/instance/server_type_data_source.go

Lines changed: 8 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package instance
22

33
import (
44
"context"
5+
56
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
67
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
78
"github.com/scaleway/scaleway-sdk-go/api/instance/v1"
@@ -17,7 +18,6 @@ func DataSourceServerType() *schema.Resource {
1718
Type: schema.TypeString,
1819
Required: true,
1920
Description: "The name of the server type",
20-
// TODO: add alt names ??
2121
},
2222
"arch": {
2323
Type: schema.TypeString,
@@ -92,28 +92,10 @@ func DataSourceServerType() *schema.Resource {
9292
Type: schema.TypeString,
9393
},
9494
},
95-
// "placement_groups": {
96-
// TODO: Field not in sdk, but equals 'true' for every server type
97-
// Type: schema.TypeBool,
98-
// Computed: true,
99-
// Description: "Whether placement groups are allowed on the server type",
100-
// },
101-
// "hot_snapshots_local_volume": {
102-
// TODO: Field not in sdk so how do we get this information ??
103-
// Type: schema.TypeBool,
104-
// Computed: true,
105-
// Description: "Whether hot_snapshots_local_volume is allowed on the server type", //TODO: rewrite this
106-
// },
107-
// "private_networks": {
108-
// TODO: Field not in sdk, but equals '8' for every server type
109-
// Type: schema.TypeInt,
110-
// Computed: true,
111-
// Description: "The number of private networks allowed on the server type",
112-
// },
11395
"max_file_systems": {
11496
Type: schema.TypeInt,
11597
Computed: true,
116-
Description: "The maximum number of files systems that can be attached to the server type",
98+
Description: "The maximum number of file systems that can be attached to the server type",
11799
},
118100
},
119101
},
@@ -139,12 +121,6 @@ func DataSourceServerType() *schema.Resource {
139121
Computed: true,
140122
Description: "The block bandwidth of the server type",
141123
},
142-
// TODO: Equals 'true' for every server type, add it anyway ?
143-
// "ipv6_support": {
144-
// Type: schema.TypeBool,
145-
// Computed: true,
146-
// Description: "Whether IPv6 is supported on the server type",
147-
// },
148124
},
149125
},
150126
},
@@ -153,6 +129,11 @@ func DataSourceServerType() *schema.Resource {
153129
Computed: true,
154130
Description: "The hourly price of the server type in euro",
155131
},
132+
"monthly_price": {
133+
Type: schema.TypeFloat,
134+
Computed: true,
135+
Description: "The monthly price of the server type in euro",
136+
},
156137
"end_of_service": {
157138
Type: schema.TypeBool,
158139
Computed: true,
@@ -169,7 +150,7 @@ func DataSourceServerType() *schema.Resource {
169150
}
170151

171152
func DataSourceInstanceServerTypeRead(ctx context.Context, d *schema.ResourceData, i any) diag.Diagnostics {
172-
instanceAPI, zone, err := newAPIWithZone(d, i) // TODO: document zone field
153+
instanceAPI, zone, err := newAPIWithZone(d, i)
173154
if err != nil {
174155
return diag.FromErr(err)
175156
}

internal/services/instance/server_type_data_source_test.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ func TestAccDataSourceServerType_Basic(t *testing.T) {
4444
resource.TestCheckResourceAttr("data.scaleway_instance_server_type.dev", "network.0.internal_bandwidth", "500000000"),
4545
resource.TestCheckResourceAttr("data.scaleway_instance_server_type.dev", "network.0.public_bandwidth", "500000000"),
4646
resource.TestCheckResourceAttr("data.scaleway_instance_server_type.dev", "network.0.block_bandwidth", "262144000"),
47-
// resource.TestCheckResourceAttr("data.scaleway_instance_server_type.dev", "network.0.ipv6_support", "true"),
4847
resource.TestCheckResourceAttr("data.scaleway_instance_server_type.dev", "end_of_service", "false"),
4948
resource.TestCheckResourceAttrSet("data.scaleway_instance_server_type.dev", "availability"),
5049
),
@@ -73,7 +72,6 @@ func TestAccDataSourceServerType_Basic(t *testing.T) {
7372
resource.TestCheckResourceAttr("data.scaleway_instance_server_type.gpu", "network.0.internal_bandwidth", "2000000000"),
7473
resource.TestCheckResourceAttr("data.scaleway_instance_server_type.gpu", "network.0.public_bandwidth", "2000000000"),
7574
resource.TestCheckResourceAttr("data.scaleway_instance_server_type.gpu", "network.0.block_bandwidth", "2147483648"),
76-
// resource.TestCheckResourceAttr("data.scaleway_instance_server_type.gpu", "network.0.ipv6_support", "true"),
7775
resource.TestCheckResourceAttr("data.scaleway_instance_server_type.gpu", "end_of_service", "false"),
7876
resource.TestCheckResourceAttrSet("data.scaleway_instance_server_type.gpu", "availability"),
7977
),
@@ -102,7 +100,6 @@ func TestAccDataSourceServerType_Basic(t *testing.T) {
102100
resource.TestCheckResourceAttr("data.scaleway_instance_server_type.pro", "network.0.internal_bandwidth", "350000000"),
103101
resource.TestCheckResourceAttr("data.scaleway_instance_server_type.pro", "network.0.public_bandwidth", "350000000"),
104102
resource.TestCheckResourceAttr("data.scaleway_instance_server_type.pro", "network.0.block_bandwidth", "131072000"),
105-
// resource.TestCheckResourceAttr("data.scaleway_instance_server_type.pro", "network.0.ipv6_support", "true"),
106103
resource.TestCheckResourceAttr("data.scaleway_instance_server_type.pro", "end_of_service", "false"),
107104
resource.TestCheckResourceAttrSet("data.scaleway_instance_server_type.pro", "availability"),
108105
),
@@ -178,8 +175,6 @@ func TestAccDataSourceServerType_CompareWithPCU(t *testing.T) {
178175
product_catalog.ListPublicCatalogProductsRequestProductTypeInstance,
179176
},
180177
Zone: &zone,
181-
// TODO: Global does not work
182-
// Global: scw.BoolPtr(true),
183178
}, scw.WithAllPages(), scw.WithContext(t.Context()))
184179
if err != nil {
185180
t.Fatal(err)

0 commit comments

Comments
 (0)