Skip to content

Commit

Permalink
Merge pull request #15 from crusoecloud/v0.5.1
Browse files Browse the repository at this point in the history
Patch Unexpected HCAs
  • Loading branch information
agutierrez8 authored Dec 6, 2023
2 parents ca014af + 3af77af commit b9e7094
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
4 changes: 2 additions & 2 deletions internal/common/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (

const (
// TODO: pull from config set during build
version = "v0.5.0"
version = "v0.5.1"

pollInterval = 2 * time.Second

Expand Down Expand Up @@ -150,7 +150,7 @@ func GetFallbackProject(ctx context.Context, client *swagger.APIClient, diag *di
diag.AddWarning("Default project not specified",
fmt.Sprintf("A project_id was not specified in the configuration file. "+
"Please specify a project in the terraform file or set a 'default_project' in your configuration file. "+
"Falling back to project: %s.", dataResp.Items[0].Name))
"Falling back to project: %s.", dataResp.Items[0].Name))
}

return projectID, nil
Expand Down
5 changes: 2 additions & 3 deletions internal/vm/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ func getDisksDiff(origDisks, newDisks []vmDiskResourceModel) (disksAdded []swagg
}
if !matched {
disksAdded = append(disksAdded, swagger.DiskAttachment{
DiskId: newDisk.ID,
DiskId: newDisk.ID,
AttachmentType: newDisk.AttachmentType,
Mode: newDisk.Mode,
Mode: newDisk.Mode,
})
}
}
Expand Down Expand Up @@ -168,7 +168,6 @@ func vmNetworkInterfacesToTerraformResourceModel(networkInterfaces []swagger.Net
func vmPartialHostChannelAdaptersToTerraformResourceModel(hostChannelAdapters []swagger.HostChannelAdapter) (hostChannelAdaptersList types.List, warning string) {

Check failure on line 168 in internal/vm/util.go

View workflow job for this annotation

GitHub Actions / lint

`vmPartialHostChannelAdaptersToTerraformResourceModel` is unused (deadcode)

Check failure on line 168 in internal/vm/util.go

View workflow job for this annotation

GitHub Actions / lint

`vmPartialHostChannelAdaptersToTerraformResourceModel` is unused (deadcode)
hcas := make([]vmHostChannelAdapterResourceModel, 0, len(hostChannelAdapters))
for _, hca := range hostChannelAdapters {

hcas = append(hcas, vmHostChannelAdapterResourceModel{
IBPartitionID: hca.IbPartitionId,
})
Expand Down
5 changes: 1 addition & 4 deletions internal/vm/vm_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ func (r *vmResource) Create(ctx context.Context, req resource.CreateRequest, res
}

plan.ID = types.StringValue(instance.Id)
plan.ProjectID = types.StringValue(projectID)

networkInterfaces, _ := vmNetworkInterfacesToTerraformResourceModel(instance.NetworkInterfaces)
plan.NetworkInterfaces = networkInterfaces
Expand All @@ -344,10 +345,6 @@ func (r *vmResource) Create(ctx context.Context, req resource.CreateRequest, res
plan.Disks = disks
}

plan.ProjectID = types.StringValue(projectID)
hcas, _ := vmPartialHostChannelAdaptersToTerraformResourceModel(instance.HostChannelAdapters)
plan.HostChannelAdapters = hcas

diags = resp.State.Set(ctx, plan)
resp.Diagnostics.Append(diags...)
}
Expand Down

0 comments on commit b9e7094

Please sign in to comment.