Skip to content

Add test fixtures for incorrect relative source in stacks #4080

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

oredavids
Copy link
Contributor

@oredavids oredavids commented Mar 25, 2025

Description

The error for wrong relative source input to a stack is misleading.
Screenshot 2025-03-25 at 2 24 34 PM

Consider messaging like 👇

Failed to fetch <unit|stack> <name> at <path>

Try:
1. Check if your source path is correct relative to the stack file location
2. Verify the units or stacks directory exists at the expected location
3. ...

Summary by CodeRabbit

  • New Features
    • Introduced a configuration block for a new unit that defines its module source and path settings.
    • Added a Terraform configuration file to establish the proper module source reference.

Copy link

vercel bot commented Mar 25, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
terragrunt-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 25, 2025 8:27pm

Copy link
Contributor

coderabbitai bot commented Mar 25, 2025

📝 Walkthrough

Walkthrough

This update introduces a new unit configuration for "app1." A configuration block is added in the stack file to declare the unit with a source set to "../../units/app1" and a path of "app1", with a comment indicating that the correct source should be "../units/app1". In addition, a new Terragrunt configuration file is created in the corresponding unit directory, setting the Terraform module source to ".".

Changes

File Change Summary
test/.../live/terragrunt.stack.hcl Added a new configuration block for unit "app1" with source = "../../units/app1" and path = "app1", along with a comment noting the intended source path.
test/.../units/app1/terragrunt.hcl Created a new Terragrunt configuration file defining the Terraform module source as "." for unit "app1".

Sequence Diagram(s)

sequenceDiagram
    participant StackConfig as Stack Config
    participant TGEngine as Terragrunt Engine
    participant UnitConfig as Unit Config

    StackConfig->>TGEngine: Load terragrunt.stack.hcl (unit "app1")
    TGEngine->>UnitConfig: Access terragrunt.hcl in unit "app1" directory
    UnitConfig-->>TGEngine: Return configuration (terraform { source = "." })
Loading

Suggested reviewers

  • levkohimins
  • yhakbar

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
test/fixtures/stacks/errors/relative-source-incorrect/live/terragrunt.stack.hcl (1)

2-5: Intentional Misconfiguration for Testing Purposes.
The unit "app1" is declared with a source set to "../../units/app1", and a comment indicates that the intended correct source is "../units/app1". This appears to be an intentional misconfiguration designed as a test fixture to simulate and validate error handling for incorrect relative source paths. Please confirm that the accompanying tests and documentation explicitly reference this intentional misconfiguration.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dd20fb1 and eac009b.

📒 Files selected for processing (2)
  • test/fixtures/stacks/errors/relative-source-incorrect/live/terragrunt.stack.hcl (1 hunks)
  • test/fixtures/stacks/errors/relative-source-incorrect/units/app1/terragrunt.hcl (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: unessential
  • GitHub Check: build-and-test
🔇 Additional comments (1)
test/fixtures/stacks/errors/relative-source-incorrect/units/app1/terragrunt.hcl (1)

1-3: Approval: Terragrunt Module Source Configuration is Correct.
The configuration block properly sets the Terraform module source to ".", which is the expected reference for a unit configuration.

@denis256
Copy link
Member

Fixed in #4078

@denis256 denis256 closed this Mar 31, 2025
@yhakbar yhakbar deleted the add-test-fixture-for-wrong-url branch March 31, 2025 15:55
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