Add TaskStage API support with models, resource, tests and examples#148
Open
TanyaSingh369-svg wants to merge 9 commits into
Open
Add TaskStage API support with models, resource, tests and examples#148TanyaSingh369-svg wants to merge 9 commits into
TanyaSingh369-svg wants to merge 9 commits into
Conversation
isivaselvan
reviewed
May 14, 2026
isivaselvan
reviewed
May 14, 2026
isivaselvan
reviewed
May 14, 2026
| permissions: Permissions | None = Field(None, alias="permissions") | ||
| actions: Actions | None = Field(None, alias="actions") | ||
|
|
||
| run: dict | None = Field(None, alias="run") |
Collaborator
There was a problem hiding this comment.
Could you update the correct model for run, instead of dict
Contributor
Author
There was a problem hiding this comment.
Updated run to use the proper Run model instead of dict.
isivaselvan
reviewed
May 14, 2026
|
|
||
| attributes["id"] = _safe_str(data.get("id")) | ||
|
|
||
| relationships = data.get("relationships", {}) |
Collaborator
There was a problem hiding this comment.
all the relationship were mapped as dict instead w.r.t models (Run, task_result, policy_evaluions)
Contributor
Author
There was a problem hiding this comment.
Updated the relationship parsing and aligned it with the API relationship response structure.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 support for Task Stages APIs in the Python TFE client, aligned with the go-tfe implementation.
Task stages represent different phases of a Terraform run and capture execution status, policy checks, and run task results. This PR enables users to retrieve a task stage by ID, list task stages for a run, and override a task stage when permitted.
The implementation follows existing repository patterns for resources and models, and includes proper handling of relationships and forward references between TaskStage, TaskResult, and PolicyEvaluation to avoid circular dependencies.
Changes
- Stage
- TaskStageStatus
- TaskStageStatusTimestamps
- Permissions
- Actions
- TaskResultStatus
- TaskResultStatusTimestamps
- TaskEnforcementLevel
Testing
- Verified service availability on the client
- Verified method presence (read, list, override)
- Tested validation for invalid inputs (e.g., missing or invalid IDs)
- Mocked HTTP transport layer to validate request construction and payloads
- Verified override behavior with and without optional comment
- All unit tests pass successfully (pytest)
- Code formatting and linting checks pass (ruff, mypy)
- Successfully retrieved task stage details via read()
- Verified response fields and structure match expected API output
Output
Run the unit test



Run the examples