diff --git a/internal/checks/state_test.go b/internal/checks/state_test.go index a016b90b53..b5bc009201 100644 --- a/internal/checks/state_test.go +++ b/internal/checks/state_test.go @@ -19,7 +19,7 @@ func TestChecksHappyPath(t *testing.T) { loader, close := configload.NewLoaderForTests(t) defer close() inst := initwd.NewModuleInstaller(loader.ModulesDir(), loader, nil) - _, instDiags := inst.InstallModules(context.Background(), fixtureDir, "tests", true, initwd.ModuleInstallHooksImpl{}) + _, instDiags := inst.InstallModules(context.Background(), fixtureDir, "tests", true, false, initwd.ModuleInstallHooksImpl{}) if instDiags.HasErrors() { t.Fatal(instDiags.Err()) } diff --git a/internal/command/command_test.go b/internal/command/command_test.go index b5d700d671..23749ba099 100644 --- a/internal/command/command_test.go +++ b/internal/command/command_test.go @@ -159,7 +159,7 @@ func testModuleWithSnapshot(t *testing.T, name string) (*configs.Config, *config // sources only this ultimately just records all of the module paths // in a JSON file so that we can load them below. inst := initwd.NewModuleInstaller(loader.ModulesDir(), loader, registry.NewClient(nil, nil)) - _, instDiags := inst.InstallModules(context.Background(), dir, "tests", true, initwd.ModuleInstallHooksImpl{}) + _, instDiags := inst.InstallModules(context.Background(), dir, "tests", true, false, initwd.ModuleInstallHooksImpl{}) if instDiags.HasErrors() { t.Fatal(instDiags.Err()) } diff --git a/internal/command/get.go b/internal/command/get.go index 008281840c..0110d7fa8d 100644 --- a/internal/command/get.go +++ b/internal/command/get.go @@ -90,5 +90,5 @@ func getModules(ctx context.Context, m *Meta, path string, testsDir string, upgr Ui: m.Ui, ShowLocalPaths: true, } - return m.installModules(ctx, path, testsDir, upgrade, hooks) + return m.installModules(ctx, path, testsDir, upgrade, true, hooks) } diff --git a/internal/command/init.go b/internal/command/init.go index 44868ea484..9b337b4c24 100644 --- a/internal/command/init.go +++ b/internal/command/init.go @@ -374,7 +374,7 @@ func (c *InitCommand) getModules(ctx context.Context, path, testsDir string, ear ShowLocalPaths: true, } - installAbort, installDiags := c.installModules(ctx, path, testsDir, upgrade, hooks) + installAbort, installDiags := c.installModules(ctx, path, testsDir, upgrade, false, hooks) diags = diags.Append(installDiags) // At this point, installModules may have generated error diags or been diff --git a/internal/command/meta_config.go b/internal/command/meta_config.go index 3d64c94cfd..4738eb926a 100644 --- a/internal/command/meta_config.go +++ b/internal/command/meta_config.go @@ -183,7 +183,7 @@ func (m *Meta) loadHCLFile(filename string) (hcl.Body, tfdiags.Diagnostics) { // can then be relayed to the end-user. The uiModuleInstallHooks type in // this package has a reasonable implementation for displaying notifications // via a provided cli.Ui. -func (m *Meta) installModules(ctx context.Context, rootDir, testsDir string, upgrade bool, hooks initwd.ModuleInstallHooks) (abort bool, diags tfdiags.Diagnostics) { +func (m *Meta) installModules(ctx context.Context, rootDir, testsDir string, upgrade, installErrsOnly bool, hooks initwd.ModuleInstallHooks) (abort bool, diags tfdiags.Diagnostics) { ctx, span := tracer.Start(ctx, "install modules") defer span.End() @@ -203,7 +203,7 @@ func (m *Meta) installModules(ctx context.Context, rootDir, testsDir string, upg inst := initwd.NewModuleInstaller(m.modulesDir(), loader, m.registryClient()) - _, moreDiags := inst.InstallModules(ctx, rootDir, testsDir, upgrade, hooks) + _, moreDiags := inst.InstallModules(ctx, rootDir, testsDir, upgrade, installErrsOnly, hooks) diags = diags.Append(moreDiags) if ctx.Err() == context.Canceled { diff --git a/internal/lang/globalref/analyzer_test.go b/internal/lang/globalref/analyzer_test.go index de207ceb45..93bea21f74 100644 --- a/internal/lang/globalref/analyzer_test.go +++ b/internal/lang/globalref/analyzer_test.go @@ -25,7 +25,7 @@ func testAnalyzer(t *testing.T, fixtureName string) *Analyzer { defer cleanup() inst := initwd.NewModuleInstaller(loader.ModulesDir(), loader, registry.NewClient(nil, nil)) - _, instDiags := inst.InstallModules(context.Background(), configDir, "tests", true, initwd.ModuleInstallHooksImpl{}) + _, instDiags := inst.InstallModules(context.Background(), configDir, "tests", true, false, initwd.ModuleInstallHooksImpl{}) if instDiags.HasErrors() { t.Fatalf("unexpected module installation errors: %s", instDiags.Err().Error()) } diff --git a/internal/refactoring/move_validate_test.go b/internal/refactoring/move_validate_test.go index 20daf652d4..3a2a79511e 100644 --- a/internal/refactoring/move_validate_test.go +++ b/internal/refactoring/move_validate_test.go @@ -538,7 +538,7 @@ func loadRefactoringFixture(t *testing.T, dir string) (*configs.Config, instance defer cleanup() inst := initwd.NewModuleInstaller(loader.ModulesDir(), loader, registry.NewClient(nil, nil)) - _, instDiags := inst.InstallModules(context.Background(), dir, "tests", true, initwd.ModuleInstallHooksImpl{}) + _, instDiags := inst.InstallModules(context.Background(), dir, "tests", true, false, initwd.ModuleInstallHooksImpl{}) if instDiags.HasErrors() { t.Fatal(instDiags.Err()) } diff --git a/internal/terraform/terraform_test.go b/internal/terraform/terraform_test.go index bd900e2fe1..ad4ca65425 100644 --- a/internal/terraform/terraform_test.go +++ b/internal/terraform/terraform_test.go @@ -67,7 +67,7 @@ func testModuleWithSnapshot(t *testing.T, name string) (*configs.Config, *config // sources only this ultimately just records all of the module paths // in a JSON file so that we can load them below. inst := initwd.NewModuleInstaller(loader.ModulesDir(), loader, registry.NewClient(nil, nil)) - _, instDiags := inst.InstallModules(context.Background(), dir, "tests", true, initwd.ModuleInstallHooksImpl{}) + _, instDiags := inst.InstallModules(context.Background(), dir, "tests", true, false, initwd.ModuleInstallHooksImpl{}) if instDiags.HasErrors() { t.Fatal(instDiags.Err()) } @@ -124,7 +124,7 @@ func testModuleInline(t *testing.T, sources map[string]string) *configs.Config { // sources only this ultimately just records all of the module paths // in a JSON file so that we can load them below. inst := initwd.NewModuleInstaller(loader.ModulesDir(), loader, registry.NewClient(nil, nil)) - _, instDiags := inst.InstallModules(context.Background(), cfgPath, "tests", true, initwd.ModuleInstallHooksImpl{}) + _, instDiags := inst.InstallModules(context.Background(), cfgPath, "tests", true, false, initwd.ModuleInstallHooksImpl{}) if instDiags.HasErrors() { t.Fatal(instDiags.Err()) }