fix: fix wrong identity handling in Read #41
1 changed files with 0 additions and 25 deletions
|
|
@ -324,13 +324,6 @@ func (r *instanceResource) Read(
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read identity data
|
|
||||||
var identityData InstanceResourceIdentityModel
|
|
||||||
resp.Diagnostics.Append(req.Identity.Get(ctx, &identityData)...)
|
|
||||||
if resp.Diagnostics.HasError() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
ctx = core.InitProviderContext(ctx)
|
ctx = core.InitProviderContext(ctx)
|
||||||
|
|
||||||
// projectId := model.ProjectId.ValueString()
|
// projectId := model.ProjectId.ValueString()
|
||||||
|
|
@ -340,34 +333,16 @@ func (r *instanceResource) Read(
|
||||||
var projectId string
|
var projectId string
|
||||||
if !model.ProjectId.IsNull() && !model.ProjectId.IsUnknown() {
|
if !model.ProjectId.IsNull() && !model.ProjectId.IsUnknown() {
|
||||||
projectId = model.ProjectId.ValueString()
|
projectId = model.ProjectId.ValueString()
|
||||||
} else {
|
|
||||||
if identityData.ProjectID.IsNull() || identityData.ProjectID.IsUnknown() {
|
|
||||||
core.LogAndAddError(ctx, &resp.Diagnostics, functionErrorSummary, "project_id not found in config")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
projectId = identityData.ProjectID.ValueString()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var region string
|
var region string
|
||||||
if !model.Region.IsNull() && !model.Region.IsUnknown() {
|
if !model.Region.IsNull() && !model.Region.IsUnknown() {
|
||||||
region = r.providerData.GetRegionWithOverride(model.Region)
|
region = r.providerData.GetRegionWithOverride(model.Region)
|
||||||
} else {
|
|
||||||
if identityData.Region.IsNull() || identityData.Region.IsUnknown() {
|
|
||||||
core.LogAndAddError(ctx, &resp.Diagnostics, functionErrorSummary, "region not found in config")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
region = r.providerData.GetRegionWithOverride(identityData.Region)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var instanceId string
|
var instanceId string
|
||||||
if !model.InstanceId.IsNull() && !model.InstanceId.IsUnknown() {
|
if !model.InstanceId.IsNull() && !model.InstanceId.IsUnknown() {
|
||||||
instanceId = model.InstanceId.ValueString()
|
instanceId = model.InstanceId.ValueString()
|
||||||
} else {
|
|
||||||
if identityData.InstanceID.IsNull() || identityData.InstanceID.IsUnknown() {
|
|
||||||
core.LogAndAddError(ctx, &resp.Diagnostics, functionErrorSummary, "instance_id not found in config")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
instanceId = identityData.InstanceID.ValueString()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx = tflog.SetField(ctx, "project_id", projectId)
|
ctx = tflog.SetField(ctx, "project_id", projectId)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue