@@ -10,15 +10,13 @@ import (
1010 "github.com/hashicorp/terraform-plugin-framework/datasource/schema"
1111 "github.com/hashicorp/terraform-plugin-framework/types"
1212 "github.com/hashicorp/terraform-provider-google/google/fwmodels"
13- "github.com/hashicorp/terraform-provider-google/google/fwresource"
1413 transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport"
1514)
1615
1716// Ensure the data source satisfies the expected interfaces.
1817var (
1918 _ datasource.DataSource = & GoogleClientConfigDataSource {}
2019 _ datasource.DataSourceWithConfigure = & GoogleClientConfigDataSource {}
21- _ fwresource.LocationDescriber = & GoogleClientConfigModel {}
2220)
2321
2422func NewGoogleClientConfigDataSource () datasource.DataSource {
@@ -40,17 +38,6 @@ type GoogleClientConfigModel struct {
4038 DefaultLabels types.Map `tfsdk:"default_labels"`
4139}
4240
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-
5441func (d * GoogleClientConfigDataSource ) Metadata (ctx context.Context , req datasource.MetadataRequest , resp * datasource.MetadataResponse ) {
5542 resp .TypeName = req .ProviderTypeName + "_client_config"
5643}
@@ -133,14 +120,10 @@ func (d *GoogleClientConfigDataSource) Read(ctx context.Context, req datasource.
133120 return
134121 }
135122
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 ))
141124 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 )
144127
145128 // Convert default labels from SDK type system to plugin-framework data type
146129 m := map [string ]* string {}
0 commit comments