fix: try fix null identity
chore: add more examples
This commit is contained in:
parent
6e895e6de8
commit
695c38d853
2 changed files with 4 additions and 23 deletions
|
|
@ -356,24 +356,12 @@ func (r *databaseResource) Update(
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read identity data
|
|
||||||
var identityData DatabaseResourceIdentityModel
|
|
||||||
resp.Diagnostics.Append(req.Identity.Get(ctx, &identityData)...)
|
|
||||||
if resp.Diagnostics.HasError() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
ctx = core.InitProviderContext(ctx)
|
ctx = core.InitProviderContext(ctx)
|
||||||
|
|
||||||
projectId, region, instanceId, databaseId64, errExt := r.extractIdentityData(model, identityData)
|
projectId := model.ProjectId.ValueString()
|
||||||
if errExt != nil {
|
instanceId := model.InstanceId.ValueString()
|
||||||
core.LogAndAddError(
|
region := model.Region.ValueString()
|
||||||
ctx,
|
databaseId64 := model.DatabaseId.ValueInt64()
|
||||||
&resp.Diagnostics,
|
|
||||||
extractErrorSummary,
|
|
||||||
fmt.Sprintf(extractErrorMessage, errExt),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if databaseId64 > math.MaxInt32 {
|
if databaseId64 > math.MaxInt32 {
|
||||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error in type conversion", "int value too large (databaseId)")
|
core.LogAndAddError(ctx, &resp.Diagnostics, "Error in type conversion", "int value too large (databaseId)")
|
||||||
|
|
|
||||||
|
|
@ -352,13 +352,6 @@ func (r *databaseResource) Read(ctx context.Context, req resource.ReadRequest, r
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read identity data
|
|
||||||
var identityData DatabaseResourceIdentityModel
|
|
||||||
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()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue