diff --git a/internal/resources/hypervisorcluster/resource.go b/internal/resources/hypervisorcluster/resource.go index c6bb682..949f55c 100644 --- a/internal/resources/hypervisorcluster/resource.go +++ b/internal/resources/hypervisorcluster/resource.go @@ -126,17 +126,6 @@ func doRead( return } - systemID := (*dataP).HciClusterUuid.ValueString() - if *(getResp.GetHciClusterUuid()) != systemID { - (*diagsP).AddError( - "error reading hypervisor cluster "+hypervisorClusterID, - fmt.Sprintf("'hciClusterUuid' mismatch: %s != %s", - *(getResp.GetHciClusterUuid()), systemID), - ) - - return - } - (*dataP).HciClusterUuid = types.StringValue(*(getResp.GetHciClusterUuid())) if getResp.GetName() == nil { @@ -220,7 +209,16 @@ func doRead( return } - (*dataP).AppInfo.Vmware = vmwareValueObj + m = map[string]attr.Value{ + "vmware": vmwareValueObj, + } + + appInfoValue, diags := NewAppInfoValue(AppInfoValue{}.AttributeTypes(ctx), m) + (*diagsP).Append(diags...) + if (*diagsP).HasError() { + return + } + (*dataP).AppInfo = appInfoValue } func doCreate( diff --git a/test/hypervisorcluster/hypervisorcluster_test.go b/test/hypervisorcluster/hypervisorcluster_test.go index 324ae3b..ed7da1a 100644 --- a/test/hypervisorcluster/hypervisorcluster_test.go +++ b/test/hypervisorcluster/hypervisorcluster_test.go @@ -127,6 +127,22 @@ func TestAccHypervisorclusterResource(t *testing.T) { testAccCheckResourceDestroyed("hpegl_pc_hypervisor_cluster.test"), ), }, + { + // Import + Check: checkFn, + Config: config1, + ImportState: true, + ResourceName: "hpegl_pc_hypervisor_cluster.test", + ImportStateId: "298a299e-78f5-5acb-86ce-4e9fdc290ab7", + ImportStatePersist: true, + }, + { + // Check post import state matches the resource config + // e.g. verfies 'name' in state matches 'name' in config + Config: config1, + Check: checkFn, + ExpectNonEmptyPlan: false, + }, }, }) }