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

[EDGE-766] Prevent issue alert UUID being outputted #45

Closed
wants to merge 1 commit into from
Closed
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
9 changes: 9 additions & 0 deletions internal/provider/resource_issue_alert.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ func (r *IssueAlertResource) Create(ctx context.Context, req resource.CreateRequ
data.Project.ValueString(),
params,
)

if err != nil {
resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Error creating issue alert: %s", err.Error()))
return
Expand Down Expand Up @@ -251,6 +252,10 @@ func (r *IssueAlertResource) Read(ctx context.Context, req resource.ReadRequest,
data.Project.ValueString(),
data.Id.ValueString(),
)
// Remove task UUID as it's not needed, otherwise it will end up in the JSON output and cause
// 'Provider caused inconsistent result after apply' errors.
action.TaskUUID = nil

if apiResp.StatusCode == http.StatusNotFound {
resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Issue alert not found: %s", err.Error()))
resp.State.RemoveResource(ctx)
Expand Down Expand Up @@ -308,6 +313,10 @@ func (r *IssueAlertResource) Update(ctx context.Context, req resource.UpdateRequ
data.Id.ValueString(),
params,
)
// Remove task UUID as it's not needed, otherwise it will end up in the JSON output and cause
// 'Provider caused inconsistent result after apply' errors.
action.TaskUUID = nil

if apiResp.StatusCode == http.StatusNotFound {
resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Notification Action not found: %s", err.Error()))
resp.State.RemoveResource(ctx)
Expand Down