diff --git a/command/console_test.go b/command/console_test.go index 5f1cfe240..b8e73fe33 100644 --- a/command/console_test.go +++ b/command/console_test.go @@ -8,8 +8,11 @@ import ( "strings" "testing" + "github.com/hashicorp/terraform/configs/configschema" "github.com/hashicorp/terraform/helper/copy" + "github.com/hashicorp/terraform/terraform" "github.com/mitchellh/cli" + "github.com/zclconf/go-cty/cty" ) // ConsoleCommand is tested primarily with tests in the "repl" package. @@ -60,6 +63,16 @@ func TestConsole_tfvars(t *testing.T) { } p := testProvider() + p.GetSchemaReturn = &terraform.ProviderSchema{ + ResourceTypes: map[string]*configschema.Block{ + "test_instance": { + Attributes: map[string]*configschema.Attribute{ + "value": {Type: cty.String, Optional: true}, + }, + }, + }, + } + ui := new(cli.MockUi) c := &ConsoleCommand{ Meta: Meta{ @@ -98,6 +111,15 @@ func TestConsole_unsetRequiredVars(t *testing.T) { defer testFixCwd(t, tmp, cwd) p := testProvider() + p.GetSchemaReturn = &terraform.ProviderSchema{ + ResourceTypes: map[string]*configschema.Block{ + "test_instance": { + Attributes: map[string]*configschema.Attribute{ + "value": {Type: cty.String, Optional: true}, + }, + }, + }, + } ui := new(cli.MockUi) c := &ConsoleCommand{ Meta: Meta{ @@ -142,7 +164,7 @@ func TestConsole_modules(t *testing.T) { defer os.RemoveAll(td) defer testChdir(t, td)() - p := testProvider() + p := applyFixtureProvider() ui := new(cli.MockUi) c := &ConsoleCommand{ diff --git a/command/graph_test.go b/command/graph_test.go index bb54d2d7a..c7696464f 100644 --- a/command/graph_test.go +++ b/command/graph_test.go @@ -20,7 +20,7 @@ func TestGraph(t *testing.T) { ui := new(cli.MockUi) c := &GraphCommand{ Meta: Meta{ - testingOverrides: metaOverridesForProvider(testProvider()), + testingOverrides: metaOverridesForProvider(applyFixtureProvider()), Ui: ui, }, } @@ -42,7 +42,7 @@ func TestGraph_multipleArgs(t *testing.T) { ui := new(cli.MockUi) c := &GraphCommand{ Meta: Meta{ - testingOverrides: metaOverridesForProvider(testProvider()), + testingOverrides: metaOverridesForProvider(applyFixtureProvider()), Ui: ui, }, } @@ -69,7 +69,7 @@ func TestGraph_noArgs(t *testing.T) { ui := new(cli.MockUi) c := &GraphCommand{ Meta: Meta{ - testingOverrides: metaOverridesForProvider(testProvider()), + testingOverrides: metaOverridesForProvider(applyFixtureProvider()), Ui: ui, }, } @@ -94,7 +94,7 @@ func TestGraph_noConfig(t *testing.T) { ui := new(cli.MockUi) c := &GraphCommand{ Meta: Meta{ - testingOverrides: metaOverridesForProvider(testProvider()), + testingOverrides: metaOverridesForProvider(applyFixtureProvider()), Ui: ui, }, } @@ -148,7 +148,7 @@ func TestGraph_plan(t *testing.T) { ui := new(cli.MockUi) c := &GraphCommand{ Meta: Meta{ - testingOverrides: metaOverridesForProvider(testProvider()), + testingOverrides: metaOverridesForProvider(applyFixtureProvider()), Ui: ui, }, } diff --git a/command/testdata/apply-vars/main.tf b/command/testdata/apply-vars/main.tf index 005abad09..1d6da85c3 100644 --- a/command/testdata/apply-vars/main.tf +++ b/command/testdata/apply-vars/main.tf @@ -1,5 +1,5 @@ variable "foo" {} resource "test_instance" "foo" { - value = "${var.foo}" + value = var.foo }