Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR adds
ConfirmedBy *User
relation field toRun
struct. Run now includesConfirmedBy
.The change aims to be part of automating terraform plan/apply verification. This aligns Run.Read return with the API's.
curl
--header "Authorization: Bearer $TOKEN"
--request GET
https://app.terraform.io/api/v2/runs/run-Hukccoek3V9yXb6h
Runs.Read(ctx context.Context, runID string) (*Run, error)
{"data":{"id":"run-","type":"runs","attributes":{"actions":{"is-cancelable":false,"is-confirmable":false,"is-discardable":false,"is-force-cancelable":false},"allow-config-generation":true,"allow-empty-apply":false,"auto-apply":false,"canceled-at":null,"created-at":"2025-04-29T06:05:13.747Z","has-changes":true,"is-destroy":false,"message":"Triggered via UI","plan-only":false,"refresh":true,"refresh-only":false,"replace-addrs":[],"save-plan":false,"source":"tfe-ui","status-timestamps":{"applied-at":"2025-04-29T06:26:05+00:00","planned-at":"2025-04-29T06:11:59+00:00","queuing-at":"2025-04-29T06:11:15+00:00","applying-at":"2025-04-29T06:25:43+00:00","planning-at":"2025-04-29T06:11:33+00:00","confirmed-at":"2025-04-29T06:25:27+00:00","plan-queued-at":"2025-04-29T06:11:16+00:00","apply-queued-at":"2025-04-29T06:25:27+00:00","queuing-apply-at":"2025-04-29T06:25:27+00:00","cost-estimated-at":"2025-04-29T06:12:00+00:00","plan-queueable-at":"2025-04-29T06:11:15+00:00","policy-checked-at":"2025-04-29T06:12:06+00:00","cost-estimating-at":"2025-04-29T06:11:59+00:00"},"status":"applied","target-addrs":null,"trigger-reason":"manual","terraform-version":"..","updated-at":"2025-04-29T06:26:05.994Z","permissions":{"can-apply":true,"can-cancel":true,"can-comment":true,"can-discard":true,"can-force-execute":true,"can-force-cancel":true,"can-override-policy-check":true},"variables":[]},"relationships":{"workspace":{"data":{"id":"ws-","type":"workspaces"}},"apply":{"data":{"id":"apply-","type":"applies"},"links":{"related":"/api/v2/runs/run-/apply"}},"configuration-version":{"data":{"id":"cv-","type":"configuration-versions"},"links":{"related":"/api/v2/runs/run-/configuration-version"}},"confirmed-by":{"data":{"id":"user-","type":"users"},"links":{"related":"/api/v2/runs/run-/confirmed-by"}},"cost-estimate":{"data":{"id":"ce-","type":"cost-estimates"},"links":{"related":"/api/v2/cost-estimates/ce-"}},"created-by":{"data":{"id":"user-","type":"users"},"links":{"related":"/api/v2/runs/run-/created-by"}},"plan":{"data":{"id":"plan-","type":"plans"},"links":{"related":"/api/v2/runs/run-/plan"}},"run-events":{"data":[{"id":"re-","type":"run-events"}],"links":{"related":"/api/v2/runs/run-/run-events"}},"task-stages":{"data":[],"links":{"related":"/api/v2/runs/run-/task-stages"}},"policy-checks":{"data":[{"id":"polchk-","type":"policy-checks"}],"links":{"related":"/api/v2/runs/run-/policy-checks"}},"comments":{"data":[],"links":{"related":"/api/v2/runs/run-/comments"}}},"links":{"self":"/api/v2/runs/run-"}}}
Testing plan
TFE_ADDRESS
andTFE_TOKEN
TFE_ADDRESS="https://example" TFE_TOKEN="example" go test ./... -v -run TestRunsConfirmedBy
. The new tests should pass.ConfirmedBy
is read for Run.External links
Output from tests
Including output from tests may require access to a TFE instance. Ignore this section if you have no environment to test against.