chore(terraform): refactor region overrides in mapping funcs (#872)
This commit is contained in:
parent
0272a86292
commit
5e5404b459
31 changed files with 185 additions and 194 deletions
|
|
@ -322,12 +322,7 @@ func (r *clusterDataSource) Read(ctx context.Context, req datasource.ReadRequest
|
|||
|
||||
projectId := state.ProjectId.ValueString()
|
||||
name := state.Name.ValueString()
|
||||
var region string
|
||||
if utils.IsUndefined(state.Region) {
|
||||
region = r.providerData.GetRegion()
|
||||
} else {
|
||||
region = state.Region.ValueString()
|
||||
}
|
||||
region := r.providerData.GetRegionWithOverride(state.Region)
|
||||
ctx = tflog.SetField(ctx, "project_id", projectId)
|
||||
ctx = tflog.SetField(ctx, "name", name)
|
||||
ctx = tflog.SetField(ctx, "region", region)
|
||||
|
|
|
|||
|
|
@ -2055,10 +2055,7 @@ func (r *clusterResource) Read(ctx context.Context, req resource.ReadRequest, re
|
|||
}
|
||||
projectId := state.ProjectId.ValueString()
|
||||
name := state.Name.ValueString()
|
||||
region := state.Region.ValueString()
|
||||
if region == "" {
|
||||
region = r.providerData.GetRegion()
|
||||
}
|
||||
region := r.providerData.GetRegionWithOverride(state.Region)
|
||||
ctx = tflog.SetField(ctx, "project_id", projectId)
|
||||
ctx = tflog.SetField(ctx, "name", name)
|
||||
ctx = tflog.SetField(ctx, "region", region)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue