parent
d1e12fcf64
commit
24b7387db9
140 changed files with 1597 additions and 7 deletions
|
|
@ -132,6 +132,8 @@ func (r *volumeAttachResource) Create(ctx context.Context, req resource.CreateRe
|
|||
return
|
||||
}
|
||||
|
||||
ctx = core.InitProviderContext(ctx)
|
||||
|
||||
projectId := model.ProjectId.ValueString()
|
||||
ctx = tflog.SetField(ctx, "project_id", projectId)
|
||||
serverId := model.ServerId.ValueString()
|
||||
|
|
@ -150,6 +152,8 @@ func (r *volumeAttachResource) Create(ctx context.Context, req resource.CreateRe
|
|||
return
|
||||
}
|
||||
|
||||
ctx = core.LogResponse(ctx)
|
||||
|
||||
_, err = wait.AddVolumeToServerWaitHandler(ctx, r.client, projectId, serverId, volumeId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error attaching volume to server", fmt.Sprintf("volume attachment waiting: %v", err))
|
||||
|
|
@ -175,6 +179,9 @@ func (r *volumeAttachResource) Read(ctx context.Context, req resource.ReadReques
|
|||
if resp.Diagnostics.HasError() {
|
||||
return
|
||||
}
|
||||
|
||||
ctx = core.InitProviderContext(ctx)
|
||||
|
||||
projectId := model.ProjectId.ValueString()
|
||||
ctx = tflog.SetField(ctx, "project_id", projectId)
|
||||
serverId := model.ServerId.ValueString()
|
||||
|
|
@ -193,6 +200,8 @@ func (r *volumeAttachResource) Read(ctx context.Context, req resource.ReadReques
|
|||
return
|
||||
}
|
||||
|
||||
ctx = core.LogResponse(ctx)
|
||||
|
||||
// Set refreshed state
|
||||
diags = resp.State.Set(ctx, model)
|
||||
resp.Diagnostics.Append(diags...)
|
||||
|
|
@ -217,6 +226,8 @@ func (r *volumeAttachResource) Delete(ctx context.Context, req resource.DeleteRe
|
|||
return
|
||||
}
|
||||
|
||||
ctx = core.InitProviderContext(ctx)
|
||||
|
||||
projectId := model.ProjectId.ValueString()
|
||||
ctx = tflog.SetField(ctx, "project_id", projectId)
|
||||
serverId := model.ServerId.ValueString()
|
||||
|
|
@ -231,6 +242,8 @@ func (r *volumeAttachResource) Delete(ctx context.Context, req resource.DeleteRe
|
|||
return
|
||||
}
|
||||
|
||||
ctx = core.LogResponse(ctx)
|
||||
|
||||
_, err = wait.RemoveVolumeFromServerWaitHandler(ctx, r.client, projectId, serverId, volumeId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error removing volume from server", fmt.Sprintf("volume removal waiting: %v", err))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue