@@ -10,15 +10,13 @@ import (
10
10
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
11
11
"github.com/hashicorp/terraform-plugin-framework/types"
12
12
"github.com/hashicorp/terraform-provider-google/google/fwmodels"
13
- "github.com/hashicorp/terraform-provider-google/google/fwresource"
14
13
transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport"
15
14
)
16
15
17
16
// Ensure the data source satisfies the expected interfaces.
18
17
var (
19
18
_ datasource.DataSource = & GoogleClientConfigDataSource {}
20
19
_ datasource.DataSourceWithConfigure = & GoogleClientConfigDataSource {}
21
- _ fwresource.LocationDescriber = & GoogleClientConfigModel {}
22
20
)
23
21
24
22
func NewGoogleClientConfigDataSource () datasource.DataSource {
@@ -40,17 +38,6 @@ type GoogleClientConfigModel struct {
40
38
DefaultLabels types.Map `tfsdk:"default_labels"`
41
39
}
42
40
43
- func (m * GoogleClientConfigModel ) GetLocationDescription (providerConfig * transport_tpg.Config ) fwresource.LocationDescription {
44
- return fwresource.LocationDescription {
45
- RegionSchemaField : types .StringValue ("region" ),
46
- ZoneSchemaField : types .StringValue ("zone" ),
47
- ResourceRegion : m .Region ,
48
- ResourceZone : m .Zone ,
49
- ProviderRegion : types .StringValue (providerConfig .Region ),
50
- ProviderZone : types .StringValue (providerConfig .Zone ),
51
- }
52
- }
53
-
54
41
func (d * GoogleClientConfigDataSource ) Metadata (ctx context.Context , req datasource.MetadataRequest , resp * datasource.MetadataResponse ) {
55
42
resp .TypeName = req .ProviderTypeName + "_client_config"
56
43
}
@@ -133,14 +120,10 @@ func (d *GoogleClientConfigDataSource) Read(ctx context.Context, req datasource.
133
120
return
134
121
}
135
122
136
- locationInfo := data .GetLocationDescription (d .providerConfig )
137
- region , _ := locationInfo .GetRegion ()
138
- zone , _ := locationInfo .GetZone ()
139
-
140
- data .Id = types .StringValue (fmt .Sprintf ("projects/%s/regions/%s/zones/%s" , d .providerConfig .Project , region .String (), zone .String ()))
123
+ data .Id = types .StringValue (fmt .Sprintf ("projects/%s/regions/%s/zones/%s" , d .providerConfig .Project , d .providerConfig .Region , d .providerConfig .Zone ))
141
124
data .Project = types .StringValue (d .providerConfig .Project )
142
- data .Region = region
143
- data .Zone = zone
125
+ data .Region = types . StringValue ( d . providerConfig . Region )
126
+ data .Zone = types . StringValue ( d . providerConfig . Zone )
144
127
145
128
// Convert default labels from SDK type system to plugin-framework data type
146
129
m := map [string ]* string {}
0 commit comments