Skip to content

Conversation

@aclevername
Copy link
Member

@aclevername aclevername commented Dec 31, 2025

  • Remove unused MODULE_SOURCE env var from tf stage
  • Rename --module-version to --module-registry-version to make the usage clear
  • error when version is provided for a non registry module
  • add more e2e test cases, including test against private repo

paired with @abangser & @codex
closes #189

@aclevername aclevername changed the title codex: did it work? feat: handle version flag correctly when using registry vs git repo Dec 31, 2025
@aclevername aclevername changed the title feat: handle version flag correctly when using registry vs git repo fix: handle version flag correctly when using registry vs git repo Dec 31, 2025
@aclevername aclevername changed the title fix: handle version flag correctly when using registry vs git repo fix: Ensure Version field is handled correctly when bootstrapping TF module Promise Dec 31, 2025
@aclevername aclevername marked this pull request as ready for review December 31, 2025 15:41
@aclevername aclevername requested a review from Copilot December 31, 2025 15:56
@syntasso syntasso deleted a comment from chatgpt-codex-connector bot Dec 31, 2025
@syntasso syntasso deleted a comment from chatgpt-codex-connector bot Dec 31, 2025
@syntasso syntasso deleted a comment from chatgpt-codex-connector bot Dec 31, 2025
Copy link

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 improves the handling of Terraform module versions when bootstrapping Terraform module Promises. The key change is renaming --module-version to --module-registry-version to clarify that this flag is only applicable to Terraform registry sources, not Git or local module sources.

Key Changes:

  • Renamed CLI flag and environment variable from MODULE_VERSION to MODULE_REGISTRY_VERSION to clarify usage
  • Added validation to error when --module-registry-version is provided with non-registry sources (Git URLs or local paths)
  • For Git sources, the version/ref is now embedded directly in the MODULE_SOURCE (e.g., git::https://...?ref=v1.0.0)
  • Added comprehensive integration tests covering Git (public and private), registry, nested registry, and local module sources
  • Updated CI workflow to support testing against private Git repositories via SSH

Reviewed changes

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

Show a summary per file
File Description
cmd/init_tf_module_promise.go Renamed flag to --module-registry-version, added validation to reject registry version with non-registry sources, updated help text and examples
internal/terraform_module.go Added IsTerraformRegistrySource() helper function to detect registry vs non-registry sources; conditionally applies version only for registry sources
internal/terraform_module_test.go Added unit tests for registry source detection and registry version handling
stages/terraform-module-promise/main.go Updated to use MODULE_REGISTRY_VERSION env var and validate it's only used with registry sources
stages/terraform-module-promise/test/stage_test.go Updated tests to use MODULE_REGISTRY_VERSION, removed separate MODULE_VERSION env var, added test for error case
test/init_tf_module_sources_test.go New comprehensive integration test covering various module source types (Git, registry, local)
test/assets/terraform/modules/local/basic/variables.tf Test fixture for local module testing
test/assets/terraform/api/*.yaml Test fixture CRD definitions for validating generated schemas from different module types
.github/workflows/tests.yaml Added SSH setup to enable testing against private Git repositories

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@aclevername
Copy link
Member Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

v1alpha1.Container{
Name: "terraform-generate",
Image: "ghcr.io/syntasso/kratix-cli/terraform-generate:v0.2.0",
Image: "ghcr.io/syntasso/kratix-cli/terraform-generate:v0.4.0",
Copy link
Member Author

Choose a reason for hiding this comment

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

this was never updated to the latest image 0.3.1 😢 pre-empting the next release of this by adding v0.4.0

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.

Chore: module-version fails when using tf-module-promise with git repo

2 participants