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

chore: Removes RemoveResource from Create and Update #2694

Merged
merged 1 commit into from
Oct 16, 2024
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
6 changes: 1 addition & 5 deletions internal/service/encryptionatrest/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,12 +384,8 @@ func (r *encryptionAtRestRS) Update(ctx context.Context, req resource.UpdateRequ
return
}
projectID := encryptionAtRestState.ProjectID.ValueString()
atlasEncryptionAtRest, atlasResp, err := connV2.EncryptionAtRestUsingCustomerKeyManagementApi.GetEncryptionAtRest(context.Background(), projectID).Execute()
atlasEncryptionAtRest, _, err := connV2.EncryptionAtRestUsingCustomerKeyManagementApi.GetEncryptionAtRest(context.Background(), projectID).Execute()
if err != nil {
if resp != nil && atlasResp.StatusCode == http.StatusNotFound {
resp.State.RemoveResource(ctx)
return
}
resp.Diagnostics.AddError("error when getting encryption at rest resource during update", fmt.Sprintf(project.ErrorProjectRead, projectID, err.Error()))
return
}
Expand Down
12 changes: 2 additions & 10 deletions internal/service/project/resource_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -402,12 +402,8 @@ func (r *projectRS) Create(ctx context.Context, req resource.CreateRequest, resp
}

projectID := project.GetId()
projectRes, atlasResp, err := connV2.ProjectsApi.GetProject(ctx, projectID).Execute()
projectRes, _, err := connV2.ProjectsApi.GetProject(ctx, projectID).Execute()
if err != nil {
if resp != nil && atlasResp.StatusCode == http.StatusNotFound {
resp.State.RemoveResource(ctx)
return
}
resp.Diagnostics.AddError("error when getting project after create", fmt.Sprintf(ErrorProjectRead, projectID, err.Error()))
return
}
Expand Down Expand Up @@ -529,12 +525,8 @@ func (r *projectRS) Update(ctx context.Context, req resource.UpdateRequest, resp
return
}

projectRes, atlasResp, err := connV2.ProjectsApi.GetProject(ctx, projectID).Execute()
projectRes, _, err := connV2.ProjectsApi.GetProject(ctx, projectID).Execute()
if err != nil {
if resp != nil && atlasResp.StatusCode == http.StatusNotFound {
resp.State.RemoveResource(ctx)
return
}
resp.Diagnostics.AddError("error when getting project after create", fmt.Sprintf(ErrorProjectRead, projectID, err.Error()))
return
}
Expand Down
4 changes: 0 additions & 4 deletions internal/service/pushbasedlogexport/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ func (r *pushBasedLogExportRS) Create(ctx context.Context, req resource.CreateRe
resp.Diagnostics.AddError("Error when unconfiguring push-based log export configuration", err.Error())
return
}

resp.State.RemoveResource(ctx)
return
}

Expand All @@ -83,8 +81,6 @@ func (r *pushBasedLogExportRS) Create(ctx context.Context, req resource.CreateRe
resp.Diagnostics.AddError("Error when unconfiguring push-based log export configuration", err.Error())
return
}

resp.State.RemoveResource(ctx)
return
}

Expand Down