Skip to content

Registry Module: Read Version Error Parsing Versions #76

@jhutchings

Description

@jhutchings

python-tfe version

v0.1.1

Description

When attempting to use the Registry Module Read Version there appears to be an error in the String Checking for Version numbers. I initially thought it was due to using a Nightly tag on the module but in testing deployed versions they also are having issues.

In checking the code, it appears to be:

        if not valid_string(version) or not valid_string_id(version):
            raise ValueError(ERR_INVALID_VERSION)

valid_string_id function's regex is invalid for SemVer, perhaps valid_version function was meant to be used like in delete_version

        if not valid_string(version) or not valid_version(version):
            raise ValueError(ERR_INVALID_VERSION)

Testing plan

1. Created a module in Terraform Private Registry
2. Using TFE Token created a small client that just reads `client.registry_modules.read_version()`
    config = TFEConfig.from_env()
    client = TFEClient(config)

    module_id = RegistryModuleID(
            organization="Test-Org",
            registry_name=RegistryName.PRIVATE,
            name="module-example",
            provider="random"
        )

    read_version = client.registry_modules.read_version(
        module_id,
        "4.0.25"
    )

Expected Behavior

Returns a valid RegistryModuleVersion

Actual Behavior

Error message:

Reading Registry Module Version...
Traceback (most recent call last):
  File "/Users/user/Desktop/code/cloudeng/pytfe-test/main.py", line 32, in <module>
    main()
    ~~~~^^
  File "/Users/user/Desktop/code/cloudeng/pytfe-test/main.py", line 26, in main
    read_version = client.registry_modules.read_version(
        module_id,
        "v4.0.25"
    )
  File "/Users/user/Desktop/code/cloudeng/pytfe-test/.venv/lib/python3.14/site-packages/pytfe/resources/registry_module.py", line 203, in read_version
    raise ValueError(ERR_INVALID_VERSION)
ValueError: invalid value for version

Additional Context

No additional unusual behaviours

Metadata

Metadata

Labels

bugSomething isn't workingwipwork in progress

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions