fix: use terraform provider api #143
Open
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.
This pull request refactors how Terraform provider download URLs and keys are generated, switching from local string construction to querying the Terraform Registry API for accurate metadata. It also updates dependencies to support async operations and adds comprehensive tests to ensure robustness across various scenarios.
Provider URL/key generation and API integration:
get_provider_url_keyinutils/src/terraform.rsto be asynchronous and fetch provider metadata from the Terraform Registry API, improving accuracy and future-proofing the logic. The function now returns aResulttype for better error handling.get_provider_url_keyinenv_common/src/logic/api_module.rsandterraform_runner/src/terraform.rsto await the async function and handle errors. [1] [2]Testing and error handling:
utils/src/terraform.rscovering valid and invalid targets, categories, and provider versions, ensuring reliability and clear error messages for edge cases.Dependency updates for async and serialization:
serdewithderivefeature and updatedreqwestto includejsonsupport inutils/Cargo.tomlfor API response deserialization.tokiowith necessary features to dev-dependencies inutils/Cargo.tomlto support async tests.