Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch Unexpected HCAs #15

Merged
merged 1 commit into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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) {
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