Skip to content

Conversation

@baa-ableton
Copy link

@baa-ableton baa-ableton commented Nov 27, 2025

Description

Fixes #4828 .

It was reported that the prompt was misleading in its wording. 'Apply' for external deps has been replaced with 'install'.

TODOs

Read the Gruntwork contribution guidelines.

  • I authored this code entirely myself
  • I am submitting code based on open source software (e.g. MIT, MPL-2.0, Apache)]
  • I am adding or upgrading a dependency or adapted code and confirm it has a compatible open source license
  • Update the docs.
  • Run the relevant tests successfully, including pre-commit checks.
  • Include release notes. If this PR is backward incompatible, include a migration guide.

Release Notes (draft)

Added / Removed / Updated [X].

Migration Guide

Summary by CodeRabbit

  • Chores
    • Updated external-dependency prompt wording from "apply" to "run" for consistent user-facing language.
  • Documentation
    • Adjusted internal docs and comments to reflect "run" terminology.
  • Tests
    • Updated integration test expectations to match the new "run" prompt wording.

✏️ Tip: You can customize this high-level summary in your review settings.

@vercel
Copy link

vercel bot commented Nov 27, 2025

@baa-ableton is attempting to deploy a commit to the Gruntwork Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 27, 2025

📝 Walkthrough

Walkthrough

Renames external-dependency handling from "apply" to "run": function and variable names, prompt text, comments, and related flags updated to use "run" semantics; a test assertion updated to match the new prompt wording.

Changes

Cohort / File(s) Summary
Unit resolver change
internal/runner/common/unit_resolver_dependencies.go
Renamed confirmShouldApplyExternalDependencyconfirmShouldRunExternalDependency; renamed shouldApplyshouldRun and related identifiers; updated prompt text and comments from "apply" to "run"; adjusted logic where unit.AssumeAlreadyApplied and unit.FlagExcluded are set to reflect !shouldRun; updated logging/messages to mention "run".
Integration test update
test/integration_destroy_test.go
Updated TestTerragruntSkipConfirmExternalDependencies assertion to expect absence of "Should Terragrunt run the external dependency?" instead of the previous "apply" wording.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Changed logic touches runtime decision flags (AssumeAlreadyApplied / FlagExcluded) — verify semantics unchanged.
  • Verify all call sites, public method signature update, and any external packages compile against the renamed exported method.
  • Confirm user-facing messages and tests (including other tests not in this diff) updated where needed.

Suggested reviewers

  • ThisGuyCodes
  • yhakbar
  • denis256

Pre-merge checks and finishing touches

❌ Failed checks (3 warnings)
Check name Status Explanation Resolution
Title check ⚠️ Warning The title 'Changed wording to install external dependency' is vague and contradicts the actual implementation which uses 'run' not 'install'. Update title to accurately reflect the change: 'Change external dependency prompt wording from apply to run' or similar.
Description check ⚠️ Warning The description claims 'Apply has been replaced with install' but the actual code changes replace 'apply' with 'run', creating a discrepancy between stated and implemented intent. Correct the description to state that the wording has been changed from 'apply' to 'run' to align with implementation and reviewer feedback.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The code changes align with issue #4828 requirements to remove misleading 'apply' wording, though using 'run' instead of 'install' as initially described.
Out of Scope Changes check ✅ Passed All changes are within scope: variable/function renames and prompt text updates directly address the misleading wording issue in #4828.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e38eab6 and e4c5e24.

📒 Files selected for processing (2)
  • internal/runner/common/unit_resolver_dependencies.go (5 hunks)
  • test/integration_destroy_test.go (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • internal/runner/common/unit_resolver_dependencies.go
🧰 Additional context used
📓 Path-based instructions (1)
**/*.go

⚙️ CodeRabbit configuration file

Review the Go code for quality and correctness. Make sure that the Go code follows best practices, is performant, and is easy to understand and maintain.

Files:

  • test/integration_destroy_test.go
🧠 Learnings (1)
📚 Learning: 2025-08-19T16:05:54.723Z
Learnt from: Resonance1584
Repo: gruntwork-io/terragrunt PR: 4683
File: go.mod:86-90
Timestamp: 2025-08-19T16:05:54.723Z
Learning: When analyzing Go module dependencies for removal, always check for both direct imports and API usage across all Go files in the repository, not just a quick search. The github.com/mattn/go-zglob library is used for filesystem walking and glob expansion in multiple Terragrunt files including util/file.go, format commands, and AWS provider patch functionality.

Applied to files:

  • test/integration_destroy_test.go
🔇 Additional comments (1)
test/integration_destroy_test.go (1)

293-347: Updated test expectation correctly reflects new “run external dependency” wording

The assertion now matches the renamed prompt ("Should Terragrunt run the external dependency?") while still verifying that the confirmation prompt is fully skipped under this feature flag. This keeps the test aligned with the new terminology and PR objective without changing behavior.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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 (2)
internal/runner/common/unit_resolver_dependencies.go (2)

23-59: Update variable and comment to match new terminology.

While the method call has been correctly updated to confirmShouldInstallExternalDependency, there are two minor inconsistencies:

  1. The variable shouldApply (line 23) still uses the old "apply" terminology
  2. The comment on line 54 says "shouldn't be applied" instead of "shouldn't be installed"

For consistency with the renamed method and updated prompt wording, consider updating these as well.

Apply this diff:

-	shouldApply := false
+	shouldInstall := false

 	if !r.Stack.TerragruntOptions.IgnoreExternalDependencies {
 		// Find a unit that depends on this external dependency for context
 		var dependentUnit *Unit

 		for _, u := range unitsMap {
 			for _, dep := range u.Dependencies {
 				if dep.Path == unit.Path {
 					dependentUnit = u
 					break
 				}
 			}

 			if dependentUnit != nil {
 				break
 			}
 		}

 		// If we found a dependent, ask the user
 		if dependentUnit != nil {
 			var err error

-			shouldApply, err = r.confirmShouldInstallExternalDependency(ctx, dependentUnit, l, unit, unit.TerragruntOptions)
+			shouldInstall, err = r.confirmShouldInstallExternalDependency(ctx, dependentUnit, l, unit, unit.TerragruntOptions)
 			if err != nil {
 				return err
 			}
 		}
 	}

-	unit.AssumeAlreadyApplied = !shouldApply
-	// Mark external dependencies as excluded if they shouldn't be applied
+	unit.AssumeAlreadyApplied = !shouldInstall
+	// Mark external dependencies as excluded if they shouldn't be installed
 	// This ensures they are tracked in the report but not executed
-	if !shouldApply {
+	if !shouldInstall {
 		unit.FlagExcluded = true
 	}

Note: The field name AssumeAlreadyApplied also uses the old terminology, but renaming it would require broader changes across the codebase and is beyond the scope of this PR.


64-68: Update comment to use consistent terminology.

The comment on line 65 still contains "already applied" which should be "already installed" to match the renamed function and updated prompt wording.

Apply this diff:

 // Confirm with the user whether they want Terragrunt to assume the given dependency of the given unit is already
-// applied. If the user selects "yes", then Terragrunt will install that unit as well.
+// installed. If the user selects "yes", then Terragrunt will install that unit as well.
 // Note that we skip the prompt for `run --all destroy` calls. Given the destructive and irreversible nature of destroy, we don't
 // want to provide any risk to the user of accidentally destroying an external dependency unless explicitly included
 // with the --queue-include-external or --queue-include-dir flags.
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3f8b187 and b52fcc8.

📒 Files selected for processing (2)
  • internal/runner/common/unit_resolver_dependencies.go (4 hunks)
  • test/integration_destroy_test.go (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.go

⚙️ CodeRabbit configuration file

Review the Go code for quality and correctness. Make sure that the Go code follows best practices, is performant, and is easy to understand and maintain.

Files:

  • test/integration_destroy_test.go
  • internal/runner/common/unit_resolver_dependencies.go
🧠 Learnings (1)
📚 Learning: 2025-08-19T16:05:54.723Z
Learnt from: Resonance1584
Repo: gruntwork-io/terragrunt PR: 4683
File: go.mod:86-90
Timestamp: 2025-08-19T16:05:54.723Z
Learning: When analyzing Go module dependencies for removal, always check for both direct imports and API usage across all Go files in the repository, not just a quick search. The github.com/mattn/go-zglob library is used for filesystem walking and glob expansion in multiple Terragrunt files including util/file.go, format commands, and AWS provider patch functionality.

Applied to files:

  • test/integration_destroy_test.go
🧬 Code graph analysis (1)
internal/runner/common/unit_resolver_dependencies.go (4)
options/options.go (1)
  • TerragruntOptions (99-329)
internal/runner/common/unit_resolver.go (1)
  • UnitResolver (47-53)
internal/runner/common/unit.go (1)
  • Unit (26-36)
shell/prompt.go (1)
  • PromptUserForYesNo (65-77)
🔇 Additional comments (4)
internal/runner/common/unit_resolver_dependencies.go (3)

12-12: LGTM: Comment updated appropriately.

The comment correctly reflects the new "install" terminology, which addresses the PR objective of avoiding the misleading "apply" wording.


69-69: LGTM: Function signature updated correctly.

The function has been appropriately renamed from confirmShouldApplyExternalDependency to confirmShouldInstallExternalDependency, maintaining the same signature and preserving all functionality.


88-88: Excellent fix for the misleading prompt wording.

This change directly addresses issue #4828 by replacing "Should Terragrunt apply the external dependency?" with "Should Terragrunt install the external dependency?". The new wording is more accurate because:

  • It doesn't imply that terraform apply will be executed when running plan operations
  • "Install" is more generic and correctly conveys that the dependency will be processed with whatever command is being run (plan, apply, etc.)
test/integration_destroy_test.go (1)

345-345: LGTM: Test assertion correctly updated.

The test assertion has been properly updated to reflect the new prompt wording. This test verifies that the prompt is NOT shown during destroy operations, which is the expected behavior per the logic in unit_resolver_dependencies.go (lines 80-84).

… installing external dependencies

Signed-off-by: Babur Ayanlar <[email protected]>
@yhakbar
Copy link
Collaborator

yhakbar commented Dec 9, 2025

Hey @baa-ableton !

Do you mind changing the verbiage to "run" instead of "install"? That's the standard term we use when Terragrunt is invoking OpenTofu/Terraform on behalf of users.

Signed-off-by: Babur Ayanlar <[email protected]>
@baa-ableton
Copy link
Author

@yhakbar I replaced all instances once again, however this also means instances of apply that are meant for developers reading the source code as well as user facing prompt lines have been changed. Pls lmk if you would like the 'apply' verbiage back for the internal instances for source code readability

@yhakbar
Copy link
Collaborator

yhakbar commented Dec 10, 2025

Looks good @baa-ableton ! Would you be willing to rebase this PR?

@baa-ableton
Copy link
Author

@yhakbar Trying to rebase showed me that the file doesnt exist anymore since:
#5100

I cannot find the same prompt that was reported in the issue so I believe this has already been resolved

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.

When running --all plan prompts contain word "apply" for dependencies

2 participants