Skip to content

Commit 4f33d1d

Browse files
authored
chore: migrate datasource to its own package (#2456)
1 parent b3b0802 commit 4f33d1d

File tree

65 files changed

+246
-177
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+246
-177
lines changed

scaleway/data_source_helpers.go renamed to internal/datasource/schemas.go

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package scaleway
1+
package datasource
22

33
import (
44
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
@@ -7,7 +7,7 @@ import (
77
"github.com/scaleway/terraform-provider-scaleway/v2/internal/locality/zonal"
88
)
99

10-
func datasourceNewZonedID(idI interface{}, fallBackZone scw.Zone) string {
10+
func NewZonedID(idI interface{}, fallBackZone scw.Zone) string {
1111
zone, id, err := zonal.ParseID(idI.(string))
1212
if err != nil {
1313
id = idI.(string)
@@ -17,7 +17,7 @@ func datasourceNewZonedID(idI interface{}, fallBackZone scw.Zone) string {
1717
return zonal.NewIDString(zone, id)
1818
}
1919

20-
func datasourceNewRegionalID(idI interface{}, fallBackRegion scw.Region) string {
20+
func NewRegionalID(idI interface{}, fallBackRegion scw.Region) string {
2121
region, id, err := regional.ParseID(idI.(string))
2222
if err != nil {
2323
id = idI.(string)
@@ -27,18 +27,16 @@ func datasourceNewRegionalID(idI interface{}, fallBackRegion scw.Region) string
2727
return regional.NewIDString(region, id)
2828
}
2929

30-
////
31-
// The below methods are imported from Google's terraform provider.
32-
// source: https://github.com/terraform-providers/terraform-provider-google/blob/master/google/datasource_helpers.go
33-
////
34-
35-
// datasourceSchemaFromResourceSchema is a recursive func that
30+
// SchemaFromResourceSchema is a recursive func that
3631
// converts an existing Resource schema to a Datasource schema.
3732
// All schema elements are copied, but certain attributes are ignored or changed:
3833
// - all attributes have Computed = true
3934
// - all attributes have ForceNew, Required = false
4035
// - Validation funcs and attributes (e.g. MaxItems) are not copied
41-
func datasourceSchemaFromResourceSchema(rs map[string]*schema.Schema) map[string]*schema.Schema {
36+
//
37+
// code imported from Google's terraform provider.
38+
// source: https://github.com/hashicorp/terraform-provider-google/blob/main/google/tpgresource/datasource_helpers.go
39+
func SchemaFromResourceSchema(rs map[string]*schema.Schema) map[string]*schema.Schema {
4240
ds := make(map[string]*schema.Schema, len(rs))
4341
for k, v := range rs {
4442
dv := &schema.Schema{
@@ -59,7 +57,7 @@ func datasourceSchemaFromResourceSchema(rs map[string]*schema.Schema) map[string
5957
if elem, ok := v.Elem.(*schema.Resource); ok {
6058
// handle the case where the Element is a sub-resource
6159
dv.Elem = &schema.Resource{
62-
Schema: datasourceSchemaFromResourceSchema(elem.Schema),
60+
Schema: SchemaFromResourceSchema(elem.Schema),
6361
}
6462
} else {
6563
// handle simple primitive case
@@ -75,20 +73,27 @@ func datasourceSchemaFromResourceSchema(rs map[string]*schema.Schema) map[string
7573
return ds
7674
}
7775

78-
// fixDatasourceSchemaFlags is a convenience func that toggles the Computed,
76+
// FixDatasourceSchemaFlags is a convenience func that toggles the Computed,
7977
// Optional + Required flags on a schema element. This is useful when the schema
8078
// has been generated (using `datasourceSchemaFromResourceSchema` above for
8179
// example) and therefore the attribute flags were not set appropriately when
8280
// first added to the schema definition. Currently only supports top-level
8381
// schema elements.
84-
func fixDatasourceSchemaFlags(schema map[string]*schema.Schema, required bool, keys ...string) {
82+
//
83+
// code imported from Google's terraform provider.
84+
// source: https://github.com/hashicorp/terraform-provider-google/blob/main/google/tpgresource/datasource_helpers.go
85+
func FixDatasourceSchemaFlags(schema map[string]*schema.Schema, required bool, keys ...string) {
8586
for _, v := range keys {
8687
schema[v].Computed = false
8788
schema[v].Optional = !required
8889
schema[v].Required = required
8990
}
9091
}
9192

92-
func addOptionalFieldsToSchema(schema map[string]*schema.Schema, keys ...string) {
93-
fixDatasourceSchemaFlags(schema, false, keys...)
93+
// AddOptionalFieldsToSchema
94+
//
95+
// code imported from Google's terraform provider.
96+
// source: https://github.com/hashicorp/terraform-provider-google/blob/main/google/tpgresource/datasource_helpers.go
97+
func AddOptionalFieldsToSchema(schema map[string]*schema.Schema, keys ...string) {
98+
FixDatasourceSchemaFlags(schema, false, keys...)
9499
}

scaleway/data_source_account_project.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@ import (
77
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
88
accountV3 "github.com/scaleway/scaleway-sdk-go/api/account/v3"
99
"github.com/scaleway/scaleway-sdk-go/scw"
10+
"github.com/scaleway/terraform-provider-scaleway/v2/internal/datasource"
1011
"github.com/scaleway/terraform-provider-scaleway/v2/internal/meta"
1112
"github.com/scaleway/terraform-provider-scaleway/v2/internal/types"
1213
"github.com/scaleway/terraform-provider-scaleway/v2/internal/verify"
1314
)
1415

1516
func dataSourceScalewayAccountProject() *schema.Resource {
16-
dsSchema := datasourceSchemaFromResourceSchema(resourceScalewayAccountProject().Schema)
17-
addOptionalFieldsToSchema(dsSchema, "name", "organization_id")
17+
dsSchema := datasource.SchemaFromResourceSchema(resourceScalewayAccountProject().Schema)
18+
datasource.AddOptionalFieldsToSchema(dsSchema, "name", "organization_id")
1819

1920
dsSchema["name"].ConflictsWith = []string{"project_id"}
2021
dsSchema["project_id"] = &schema.Schema{

scaleway/data_source_baremetal_offer.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
1010
"github.com/scaleway/scaleway-sdk-go/api/baremetal/v1"
1111
"github.com/scaleway/scaleway-sdk-go/scw"
12+
"github.com/scaleway/terraform-provider-scaleway/v2/internal/datasource"
1213
"github.com/scaleway/terraform-provider-scaleway/v2/internal/locality/zonal"
1314
)
1415

@@ -150,7 +151,7 @@ func dataSourceScalewayBaremetalOfferRead(ctx context.Context, d *schema.Resourc
150151
return diag.FromErr(err)
151152
}
152153

153-
zone, offerID, _ := zonal.ParseID(datasourceNewZonedID(d.Get("offer_id"), fallBackZone))
154+
zone, offerID, _ := zonal.ParseID(datasource.NewZonedID(d.Get("offer_id"), fallBackZone))
154155

155156
var offer *baremetal.Offer
156157

@@ -203,7 +204,7 @@ func dataSourceScalewayBaremetalOfferRead(ctx context.Context, d *schema.Resourc
203204
offer = matches[0]
204205
}
205206

206-
zonedID := datasourceNewZonedID(offer.ID, zone)
207+
zonedID := datasource.NewZonedID(offer.ID, zone)
207208
d.SetId(zonedID)
208209
_ = d.Set("offer_id", zonedID)
209210
_ = d.Set("zone", zone)

scaleway/data_source_baremetal_option.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
99
"github.com/scaleway/scaleway-sdk-go/api/baremetal/v1"
1010
"github.com/scaleway/scaleway-sdk-go/scw"
11+
"github.com/scaleway/terraform-provider-scaleway/v2/internal/datasource"
1112
"github.com/scaleway/terraform-provider-scaleway/v2/internal/locality/zonal"
1213
"github.com/scaleway/terraform-provider-scaleway/v2/internal/verify"
1314
)
@@ -77,7 +78,7 @@ func dataSourceScalewayBaremetalOptionRead(ctx context.Context, d *schema.Resour
7778
}
7879
}
7980

80-
zoneID := datasourceNewZonedID(optionID, zone)
81+
zoneID := datasource.NewZonedID(optionID, zone)
8182
d.SetId(zoneID)
8283

8384
_ = d.Set("option_id", zoneID)

scaleway/data_source_baremetal_os.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
99
"github.com/scaleway/scaleway-sdk-go/api/baremetal/v1"
1010
"github.com/scaleway/scaleway-sdk-go/scw"
11+
"github.com/scaleway/terraform-provider-scaleway/v2/internal/datasource"
1112
"github.com/scaleway/terraform-provider-scaleway/v2/internal/locality/zonal"
1213
"github.com/scaleway/terraform-provider-scaleway/v2/internal/verify"
1314
)
@@ -79,7 +80,7 @@ func dataSourceScalewayBaremetalOsRead(ctx context.Context, d *schema.ResourceDa
7980
}
8081
}
8182

82-
zoneID := datasourceNewZonedID(osID, zone)
83+
zoneID := datasource.NewZonedID(osID, zone)
8384
d.SetId(zoneID)
8485

8586
_ = d.Set("os_id", zoneID)

scaleway/data_source_baremetal_server.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,17 @@ import (
77
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
88
"github.com/scaleway/scaleway-sdk-go/api/baremetal/v1"
99
"github.com/scaleway/scaleway-sdk-go/scw"
10+
"github.com/scaleway/terraform-provider-scaleway/v2/internal/datasource"
1011
"github.com/scaleway/terraform-provider-scaleway/v2/internal/types"
1112
"github.com/scaleway/terraform-provider-scaleway/v2/internal/verify"
1213
)
1314

1415
func dataSourceScalewayBaremetalServer() *schema.Resource {
1516
// Generate datasource schema from resource
16-
dsSchema := datasourceSchemaFromResourceSchema(resourceScalewayBaremetalServer().Schema)
17+
dsSchema := datasource.SchemaFromResourceSchema(resourceScalewayBaremetalServer().Schema)
1718

1819
// Set 'Optional' schema elements
19-
addOptionalFieldsToSchema(dsSchema, "name", "zone", "project_id")
20+
datasource.AddOptionalFieldsToSchema(dsSchema, "name", "zone", "project_id")
2021

2122
dsSchema["name"].ConflictsWith = []string{"server_id"}
2223
dsSchema["server_id"] = &schema.Schema{
@@ -63,7 +64,7 @@ func dataSourceScalewayBaremetalServerRead(ctx context.Context, d *schema.Resour
6364
serverID = foundServer.ID
6465
}
6566

66-
zoneID := datasourceNewZonedID(serverID, zone)
67+
zoneID := datasource.NewZonedID(serverID, zone)
6768
d.SetId(zoneID)
6869
err = d.Set("server_id", zoneID)
6970
if err != nil {

scaleway/data_source_block_snapshot.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,16 @@ import (
66
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
77
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
88
block "github.com/scaleway/scaleway-sdk-go/api/block/v1alpha1"
9+
"github.com/scaleway/terraform-provider-scaleway/v2/internal/datasource"
910
"github.com/scaleway/terraform-provider-scaleway/v2/internal/types"
1011
"github.com/scaleway/terraform-provider-scaleway/v2/internal/verify"
1112
)
1213

1314
func dataSourceScalewayBlockSnapshot() *schema.Resource {
1415
// Generate datasource schema from resource
15-
dsSchema := datasourceSchemaFromResourceSchema(resourceScalewayBlockSnapshot().Schema)
16+
dsSchema := datasource.SchemaFromResourceSchema(resourceScalewayBlockSnapshot().Schema)
1617

17-
addOptionalFieldsToSchema(dsSchema, "name", "zone", "volume_id", "project_id")
18+
datasource.AddOptionalFieldsToSchema(dsSchema, "name", "zone", "volume_id", "project_id")
1819

1920
dsSchema["snapshot_id"] = &schema.Schema{
2021
Type: schema.TypeString,
@@ -60,7 +61,7 @@ func dataSourceScalewayBlockSnapshotRead(ctx context.Context, d *schema.Resource
6061
}
6162
}
6263

63-
zoneID := datasourceNewZonedID(snapshotID, zone)
64+
zoneID := datasource.NewZonedID(snapshotID, zone)
6465
d.SetId(zoneID)
6566
err = d.Set("snapshot_id", zoneID)
6667
if err != nil {

scaleway/data_source_block_volume.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,16 @@ import (
66
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
77
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
88
block "github.com/scaleway/scaleway-sdk-go/api/block/v1alpha1"
9+
"github.com/scaleway/terraform-provider-scaleway/v2/internal/datasource"
910
"github.com/scaleway/terraform-provider-scaleway/v2/internal/types"
1011
"github.com/scaleway/terraform-provider-scaleway/v2/internal/verify"
1112
)
1213

1314
func dataSourceScalewayBlockVolume() *schema.Resource {
1415
// Generate datasource schema from resource
15-
dsSchema := datasourceSchemaFromResourceSchema(resourceScalewayBlockVolume().Schema)
16+
dsSchema := datasource.SchemaFromResourceSchema(resourceScalewayBlockVolume().Schema)
1617

17-
addOptionalFieldsToSchema(dsSchema, "name", "zone", "project_id")
18+
datasource.AddOptionalFieldsToSchema(dsSchema, "name", "zone", "project_id")
1819

1920
dsSchema["volume_id"] = &schema.Schema{
2021
Type: schema.TypeString,
@@ -59,7 +60,7 @@ func dataSourceScalewayBlockVolumeRead(ctx context.Context, d *schema.ResourceDa
5960
}
6061
}
6162

62-
zoneID := datasourceNewZonedID(volumeID, zone)
63+
zoneID := datasource.NewZonedID(volumeID, zone)
6364
d.SetId(zoneID)
6465
err = d.Set("volume_id", zoneID)
6566
if err != nil {

scaleway/data_source_cockpit.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@ import (
55

66
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
77
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
8+
"github.com/scaleway/terraform-provider-scaleway/v2/internal/datasource"
89
"github.com/scaleway/terraform-provider-scaleway/v2/internal/verify"
910
)
1011

1112
func dataSourceScalewayCockpit() *schema.Resource {
1213
// Generate datasource schema from resource
13-
dsSchema := datasourceSchemaFromResourceSchema(resourceScalewayCockpit().Schema)
14+
dsSchema := datasource.SchemaFromResourceSchema(resourceScalewayCockpit().Schema)
1415

1516
dsSchema["project_id"] = &schema.Schema{
1617
Type: schema.TypeString,

scaleway/data_source_container.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,17 @@ import (
77
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
88
container "github.com/scaleway/scaleway-sdk-go/api/container/v1beta1"
99
"github.com/scaleway/scaleway-sdk-go/scw"
10+
"github.com/scaleway/terraform-provider-scaleway/v2/internal/datasource"
1011
"github.com/scaleway/terraform-provider-scaleway/v2/internal/locality"
1112
"github.com/scaleway/terraform-provider-scaleway/v2/internal/types"
1213
"github.com/scaleway/terraform-provider-scaleway/v2/internal/verify"
1314
)
1415

1516
func dataSourceScalewayContainer() *schema.Resource {
1617
// Generate datasource schema from resource
17-
dsSchema := datasourceSchemaFromResourceSchema(resourceScalewayContainer().Schema)
18+
dsSchema := datasource.SchemaFromResourceSchema(resourceScalewayContainer().Schema)
1819

19-
addOptionalFieldsToSchema(dsSchema, "name", "region")
20+
datasource.AddOptionalFieldsToSchema(dsSchema, "name", "region")
2021

2122
dsSchema["name"].ConflictsWith = []string{"container_id"}
2223
dsSchema["container_id"] = &schema.Schema{
@@ -77,7 +78,7 @@ func dataSourceScalewayContainerRead(ctx context.Context, d *schema.ResourceData
7778
containerID = foundContainer.ID
7879
}
7980

80-
regionalID := datasourceNewRegionalID(containerID, region)
81+
regionalID := datasource.NewRegionalID(containerID, region)
8182
d.SetId(regionalID)
8283
_ = d.Set("container_id", regionalID)
8384

scaleway/data_source_container_namespace.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,16 @@ import (
77
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
88
container "github.com/scaleway/scaleway-sdk-go/api/container/v1beta1"
99
"github.com/scaleway/scaleway-sdk-go/scw"
10+
"github.com/scaleway/terraform-provider-scaleway/v2/internal/datasource"
1011
"github.com/scaleway/terraform-provider-scaleway/v2/internal/types"
1112
"github.com/scaleway/terraform-provider-scaleway/v2/internal/verify"
1213
)
1314

1415
func dataSourceScalewayContainerNamespace() *schema.Resource {
1516
// Generate datasource schema from resource
16-
dsSchema := datasourceSchemaFromResourceSchema(resourceScalewayContainerNamespace().Schema)
17+
dsSchema := datasource.SchemaFromResourceSchema(resourceScalewayContainerNamespace().Schema)
1718

18-
addOptionalFieldsToSchema(dsSchema, "name", "region", "project_id")
19+
datasource.AddOptionalFieldsToSchema(dsSchema, "name", "region", "project_id")
1920

2021
dsSchema["name"].ConflictsWith = []string{"namespace_id"}
2122
dsSchema["namespace_id"] = &schema.Schema{
@@ -62,7 +63,7 @@ func dataSourceScalewayContainerNamespaceRead(ctx context.Context, d *schema.Res
6263
namespaceID = foundNamespace.ID
6364
}
6465

65-
regionalID := datasourceNewRegionalID(namespaceID, region)
66+
regionalID := datasource.NewRegionalID(namespaceID, region)
6667
d.SetId(regionalID)
6768
_ = d.Set("namespace_id", regionalID)
6869

scaleway/data_source_document_db_database.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@ import (
55

66
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
77
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
8+
"github.com/scaleway/terraform-provider-scaleway/v2/internal/datasource"
89
"github.com/scaleway/terraform-provider-scaleway/v2/internal/locality"
910
)
1011

1112
func dataSourceScalewayDocumentDBDatabase() *schema.Resource {
1213
// Generate datasource schema from resource
13-
dsSchema := datasourceSchemaFromResourceSchema(resourceScalewayDocumentDBDatabase().Schema)
14+
dsSchema := datasource.SchemaFromResourceSchema(resourceScalewayDocumentDBDatabase().Schema)
1415

15-
addOptionalFieldsToSchema(dsSchema, "name", "region")
16+
datasource.AddOptionalFieldsToSchema(dsSchema, "name", "region")
1617

1718
dsSchema["instance_id"].Required = true
1819
dsSchema["instance_id"].Computed = false

scaleway/data_source_document_db_instance.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,16 @@ import (
66
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
77
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
88
documentdb "github.com/scaleway/scaleway-sdk-go/api/documentdb/v1beta1"
9+
"github.com/scaleway/terraform-provider-scaleway/v2/internal/datasource"
910
"github.com/scaleway/terraform-provider-scaleway/v2/internal/types"
1011
"github.com/scaleway/terraform-provider-scaleway/v2/internal/verify"
1112
)
1213

1314
func dataSourceScalewayDocumentDBInstance() *schema.Resource {
1415
// Generate datasource schema from resource
15-
dsSchema := datasourceSchemaFromResourceSchema(resourceScalewayDocumentDBInstance().Schema)
16+
dsSchema := datasource.SchemaFromResourceSchema(resourceScalewayDocumentDBInstance().Schema)
1617

17-
addOptionalFieldsToSchema(dsSchema, "name", "region", "project_id")
18+
datasource.AddOptionalFieldsToSchema(dsSchema, "name", "region", "project_id")
1819

1920
dsSchema["instance_id"] = &schema.Schema{
2021
Type: schema.TypeString,
@@ -60,7 +61,7 @@ func dataSourceScalewayDocumentDBInstanceRead(ctx context.Context, d *schema.Res
6061
instanceID = foundRawInstance.ID
6162
}
6263

63-
regionID := datasourceNewRegionalID(instanceID, region)
64+
regionID := datasource.NewRegionalID(instanceID, region)
6465
d.SetId(regionID)
6566
err = d.Set("instance_id", regionID)
6667
if err != nil {

scaleway/data_source_document_db_load_balancer_endpoint.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
77
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
88
documentdb "github.com/scaleway/scaleway-sdk-go/api/documentdb/v1beta1"
9+
"github.com/scaleway/terraform-provider-scaleway/v2/internal/datasource"
910
"github.com/scaleway/terraform-provider-scaleway/v2/internal/locality"
1011
"github.com/scaleway/terraform-provider-scaleway/v2/internal/locality/regional"
1112
"github.com/scaleway/terraform-provider-scaleway/v2/internal/types"
@@ -102,7 +103,7 @@ func dataSourceScalewayDocumentDBLoadBalancerRead(ctx context.Context, d *schema
102103
_ = d.Set("ip", types.FlattenIPPtr(lb.IP))
103104
_ = d.Set("name", lb.Name)
104105

105-
d.SetId(datasourceNewRegionalID(lb.ID, region))
106+
d.SetId(datasource.NewRegionalID(lb.ID, region))
106107

107108
return nil
108109
}

0 commit comments

Comments
 (0)