fix: fix wrong identity handling in Read
Some checks failed
CI Workflow / Check GoReleaser config (pull_request) Successful in 4s
CI Workflow / Test readiness for publishing provider (pull_request) Successful in 11m38s
CI Workflow / CI (pull_request) Failing after 15m11s
CI Workflow / Code coverage report (pull_request) Has been skipped
Some checks failed
CI Workflow / Check GoReleaser config (pull_request) Successful in 4s
CI Workflow / Test readiness for publishing provider (pull_request) Successful in 11m38s
CI Workflow / CI (pull_request) Failing after 15m11s
CI Workflow / Code coverage report (pull_request) Has been skipped
This commit is contained in:
parent
b63526b065
commit
0d49e767d0
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