Skip to content

Add Readme section to get_module_details output#306

Open
huynhsontung wants to merge 3 commits intohashicorp:mainfrom
huynhsontung:copilot/add-readme-section-output
Open

Add Readme section to get_module_details output#306
huynhsontung wants to merge 3 commits intohashicorp:mainfrom
huynhsontung:copilot/add-readme-section-output

Conversation

@huynhsontung
Copy link
Copy Markdown

get_module_details was not surfacing the root README from the registry API response. This adds the README to the output, filtered to remove sections (inputs, outputs, dependencies, resources) already represented as structured data — consistent with how get_private_module_details handles it.

Changes

  • pkg/utils/utils.go — Promoted removeReadmeSections from tfe package to shared, exported RemoveReadmeSections utility to avoid duplication
  • pkg/tools/registry/get_module_details.go — Added ### Readme section at the end of unmarshalTerraformModule, populated from Root.Readme and cleaned via utils.RemoveReadmeSections; skipped when empty
  • pkg/tools/tfe/get_private_module_details.go — Replaced local removeReadmeSections call with utils.RemoveReadmeSections; removed now-unused regexp import
  • Tests — Added TestRemoveReadmeSections in utils_test.go; added TestUnmarshalModuleSingular_WithReadme and TestUnmarshalModuleSingular_EmptyReadme in get_module_details_test.go

PCI review checklist

  • I have documented a clear reason for, and description of, the change I am making.

  • If applicable, I've documented a plan to revert these changes if they require more than reverting the pull request.

  • If applicable, I've documented the impact of any changes to security controls.

    Examples of changes to security controls include using new access control methods, adding or removing logging pipelines, etc.

@huynhsontung huynhsontung requested a review from a team as a code owner March 27, 2026 07:02
@hashicorp-cla-app
Copy link
Copy Markdown

hashicorp-cla-app bot commented Mar 27, 2026

CLA assistant check

Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement

Learn more about why HashiCorp requires a CLA and what the CLA includes


1 out of 2 committers have signed the CLA.

  • huynhsontung
  • Copilot

Have you signed the CLA already but the status is still pending? Recheck it.

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