Skip to content

Add Users.read endpoint for Terraform Cloud User API#115

Closed
TanyaSingh369-svg wants to merge 17 commits into
hashicorp:next-1.0.0from
TanyaSingh369-svg:user-api-specs
Closed

Add Users.read endpoint for Terraform Cloud User API#115
TanyaSingh369-svg wants to merge 17 commits into
hashicorp:next-1.0.0from
TanyaSingh369-svg:user-api-specs

Conversation

@TanyaSingh369-svg

@TanyaSingh369-svg TanyaSingh369-svg commented Mar 16, 2026

Copy link
Copy Markdown
Contributor

Description

Summary

This PR adds support for the Terraform Cloud User API in the Python SDK.

Changes

  • Implemented Users.read(user_id) resource based on the User API endpoint.
  • Added input validation using valid_string_id.
  • Integrated the Users service into the TFE client.
  • Parsed API responses into the existing User model.
  • Added unit tests for response parsing and invalid ID validation.

Testing

  • Added tests in tests/units/test_user.py.
  • Verified the new tests pass locally.
  • Verified the full test suite passes successfully.

Testing Plan

  1. Run the new Users resource tests:
    PYTHONPATH=. pytest tests/units/test_user.py -v

    Output:

    • tests/units/test_user.py::TestUsers::test_read_user PASSED
    • tests/units/test_user.py::TestUsers::test_read_user_invalid_id PASSED
Screenshot 2026-03-16 at 12 22 39 PM
  1. Run the full unit test suite:
    PYTHONPATH=. pytest
Screenshot 2026-03-16 at 12 23 23 PM Output:
  1. Verified the following behavior:
    • Users.read(user_id) sends a GET request to /api/v2/users/{user_id}
    • the API response is parsed into the existing User model
    • invalid user_id input triggers validation failure

@TanyaSingh369-svg TanyaSingh369-svg requested a review from a team as a code owner March 16, 2026 06:53
@TanyaSingh369-svg

Copy link
Copy Markdown
Contributor Author

I raised a clean replacement PR with only the User API related changes, so I’m closing this one to avoid unrelated diff changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants