-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: handle run-events request from terraform cloud backend (#534)
`terraform plan|apply` as of v1.5 sends a request to `/api/v2/runs/<run_id>/run-events` if using the `cloud` backend. OTF did not handle this request and hence terraform would error with `resource not found`. This PR stubs this endpoint, returning an empty response, which works around the issue. (Run events would usually be warnings about various policy issues OTF doesn't implement anyway).
- Loading branch information
Showing
2 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright (c) HashiCorp, Inc. | ||
// SPDX-License-Identifier: MPL-2.0 | ||
|
||
package types | ||
|
||
import "time" | ||
|
||
// RunEventList represents a list of run events. | ||
type RunEventList struct { | ||
// Pagination is not supported by the API | ||
*Pagination | ||
Items []*RunEvent | ||
} | ||
|
||
// RunEvent represents a Terraform Enterprise run event. | ||
type RunEvent struct { | ||
ID string `jsonapi:"primary,run-events"` | ||
Action string `jsonapi:"attr,action"` | ||
CreatedAt time.Time `jsonapi:"attr,created-at,iso8601"` | ||
Description string `jsonapi:"attr,description"` | ||
|
||
// Relations - Note that `target` is not supported yet | ||
Actor *User `jsonapi:"relation,actor"` | ||
// Comment *Comment `jsonapi:"relation,comment"` | ||
} |