Skip to content

Commit

Permalink
fix google_client_config (#7953) (#14618)
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored May 16, 2023
1 parent 3892009 commit 7dd0a58
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
3 changes: 3 additions & 0 deletions .changelog/7953.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
provider: fixed an issue where `google_client_config` datasource return `null` for all attributes when region or zone is unset in provider config
```
12 changes: 2 additions & 10 deletions google/data_source_google_client_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,16 +124,8 @@ func (d *GoogleClientConfigDataSource) Read(ctx context.Context, req datasource.
}

locationInfo := data.GetLocationDescription(d.providerConfig)
region, err := locationInfo.GetRegion()
if err != nil {
diags.AddError("Error getting region value", err.Error())
return
}
zone, err := locationInfo.GetZone()
if err != nil {
diags.AddError("Error getting zone value", err.Error())
return
}
region, _ := locationInfo.GetRegion()
zone, _ := locationInfo.GetZone()

data.Id = types.StringValue(fmt.Sprintf("projects/%s/regions/%s/zones/%s", d.providerConfig.project.String(), region.String(), zone.String()))
data.Project = d.providerConfig.project
Expand Down

0 comments on commit 7dd0a58

Please sign in to comment.