diff --git a/command/init_test.go b/command/init_test.go index b47936f057..cd611301b7 100644 --- a/command/init_test.go +++ b/command/init_test.go @@ -1063,3 +1063,27 @@ func TestInit_pluginDirProvidersDoesNotGet(t *testing.T) { t.Fatalf("bad: \n%s", ui.OutputWriter) } } + +// Verify that plugin-dir doesn't prevent discovery of internal providers +func TestInit_pluginWithInternal(t *testing.T) { + td := tempDir(t) + copy.CopyDir(testFixturePath("init-internal"), td) + defer os.RemoveAll(td) + defer testChdir(t, td)() + + ui := new(cli.MockUi) + m := Meta{ + testingOverrides: metaOverridesForProvider(testProvider()), + Ui: ui, + } + + c := &InitCommand{ + Meta: m, + } + + args := []string{"-plugin-dir", "./"} + //args := []string{} + if code := c.Run(args); code != 0 { + t.Fatalf("error: %s", ui.ErrorWriter) + } +} diff --git a/command/test-fixtures/init-internal/main.tf b/command/test-fixtures/init-internal/main.tf new file mode 100644 index 0000000000..962d7114bd --- /dev/null +++ b/command/test-fixtures/init-internal/main.tf @@ -0,0 +1 @@ +provider "terraform" {}