Extend DSA Reads to compute plan name and version from plan ID (#20)

* Extend Read to compute plan name and version from plan ID

* Lint

* Fix error handling; Pass client to loadPlanNameAndVersion

* Change error to warning

* Replicate to other DSA

* Update acc tests to test import of plan name and version
This commit is contained in:
João Palet 2023-09-20 11:00:08 +02:00 committed by GitHub
parent 7f35b5a1dc
commit 386ccac6b4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 240 additions and 42 deletions

View file

@ -191,6 +191,13 @@ func (r *instanceDataSource) Read(ctx context.Context, req datasource.ReadReques
core.LogAndAddError(ctx, &resp.Diagnostics, "Mapping fields", err.Error())
return
}
// Compute and store values not present in the API response
loadPlanNameAndVersion(ctx, r.client, &resp.Diagnostics, &state)
if resp.Diagnostics.HasError() {
return
}
// Set refreshed state
diags = resp.State.Set(ctx, &state)
resp.Diagnostics.Append(diags...)