这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@shinji62
Copy link
Contributor

Read module from the json file produced by Terraform in case of Terraform Cloud.

Starting with app.terraform.io

@JamesWoolfenden JamesWoolfenden requested a review from Copilot June 19, 2025 18:35

This comment was marked as outdated.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@JamesWoolfenden JamesWoolfenden requested a review from Copilot June 19, 2025 18:38
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds functionality to read module information from a JSON manifest produced by Terraform Cloud and integrates it into module resolution logic.

  • Introduces ReadModuleJson and ReadModuleJsonForDir functions to parse a modules.json file.
  • Updates GetLocalModules to use parsed module data when the module source matches Terraform Cloud patterns.
  • Adjusts tests and dependency versions accordingly.

Reviewed Changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.

File Description
src/modules.go New module JSON snapshot parsing and mapping implementations.
src/data.go Updated resource functions to utilize module JSON data.
src/data_test.go Modified tests to pass module JSON to the GetLocalModules function.
go.mod Updated dependency versions to support new functionality.
Comments suppressed due to low confidence (1)

src/modules.go:48

  • [nitpick] Consider renaming the variable 'new' to a more descriptive name such as 'moduleRecords' to improve code readability.
	new := make(ModuleJson)

@JamesWoolfenden
Copy link
Owner

thanks for the contribution! could you add some tests for the new code file? ta.

@JamesWoolfenden JamesWoolfenden merged commit cd9c0cf into JamesWoolfenden:master Jun 20, 2025
1 of 2 checks passed
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.

2 participants