in teamcity/global.go [177:211]
func (r *globalResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) {
var oldState globalResourceModel
diags := req.State.Get(ctx, &oldState)
resp.Diagnostics.Append(diags...)
if resp.Diagnostics.HasError() {
return
}
result, err := r.client.GetGlobalSettings()
if err != nil {
resp.Diagnostics.AddError(
"Unable to read global settings",
err.Error(),
)
return
}
newState, err := r.readState(*result)
if err != nil {
resp.Diagnostics.AddError(
"Unable to read global settings",
err.Error(),
)
return
}
if newState.Encryption != nil {
newState.Encryption.Key = oldState.Encryption.Key
}
diags = resp.State.Set(ctx, newState)
resp.Diagnostics.Append(diags...)
if resp.Diagnostics.HasError() {
return
}
}