Skip to content

Add additional Run Sources to runs model. #89

@gatesy666

Description

@gatesy666

Use-cases

When listing runs in an organisation client.runs.list_for_organization(args.organization, org_options) will fail with the following pedantic error:

pydantic_core._pydantic_core.ValidationError: 1 validation error for Run
source
  Input should be 'tfe-api', 'tfe-configuration-version', 'tfe-ui' or 'terraform+cloud' [type=enum, input_value='terraform', input_type=str]
    For further information visit https://errors.pydantic.dev/2.12/v/enum

This will also occur when runs have a source of:

tfe-run-trigger
tfe-infrastructure-lifecycle

Attempted Solutions

To allow runs.list_for_organization to successfully retrieve all runs; adding the following to class RunSource(str, Enum) in models/run.py has worked for me:

Run_Source_Terraform = "terraform"
Run_Source_Run_Trigger = "tfe-run-trigger"
Run_Source_Infra_Lifecycle = "tfe-infrastructure-lifecycle"

Proposal

Could all possible run sources for a run be added to the RunSource model.

class RunSource(str, Enum):
    """RunSource represents a source type of a run."""

    Run_Source_API = "tfe-api"
    Run_Source_Configuration_Version = "tfe-configuration-version"
    Run_Source_UI = "tfe-ui"
    Run_Source_Terraform_Cloud = "terraform+cloud"
    Run_Source_Terraform = "terraform"
    Run_Source_Run_Trigger = "tfe-run-trigger"
    Run_Source_Infra_Lifecycle = "tfe-infrastructure-lifecycle"
    # Add any other possible sources...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions