Skip to content

Project field not returning properly in workspace #73

@anoonan-zz

Description

@anoonan-zz

python-tfe version

0.1.0

Description

When accessing a workspace, the workspace object contains a project_id attribute, but that attribute is set to None even though the workspace itself is assigned to a project. This seems to be because the workspace _ws_from() function uses:

    proj_id: str | None = None
    proj = attr.get("project")
    if isinstance(proj, dict):
        proj_id = proj.get("id") if isinstance(proj.get("id"), str) else None

to get the project ID. Unfortunately, the project_id, at least in TFE 1.0 and, to my knowledge, earlier versions, is not stored in the attributes section, but in the relationships section (.data.relationships.project.data.id)

Testing plan

1. use workspace.show() to gather a workspace object.
2. print the project_id for the workspace

Expected Behavior

The project ID is printed

Actual Behavior

is ID is shown as "None"

Additional Context

Running TFE 1.0.0 right now

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions