From 00a177cd99b702fd11f9dbc5378375c92c451ddd Mon Sep 17 00:00:00 2001 From: Paul Hinze Date: Mon, 29 Jun 2015 11:35:02 -0500 Subject: [PATCH] provider/aws: add test for provider aliases Not sure if this test has value /cc @mitchellh (who requested one be added) to see what I might be missing here. refs #2495 --- terraform/context_test.go | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/terraform/context_test.go b/terraform/context_test.go index 0cb2561681..60ff159e9e 100644 --- a/terraform/context_test.go +++ b/terraform/context_test.go @@ -4423,6 +4423,37 @@ func TestContext2Apply_moduleProviderAlias(t *testing.T) { } } +func TestContext2Apply_moduleProviderAliasTargets(t *testing.T) { + m := testModule(t, "apply-module-provider-alias") + p := testProvider("aws") + p.ApplyFn = testApplyFn + p.DiffFn = testDiffFn + ctx := testContext2(t, &ContextOpts{ + Module: m, + Providers: map[string]ResourceProviderFactory{ + "aws": testProviderFuncFixed(p), + }, + Targets: []string{"no.thing"}, + }) + + if _, err := ctx.Plan(); err != nil { + t.Fatalf("err: %s", err) + } + + state, err := ctx.Apply() + if err != nil { + t.Fatalf("err: %s", err) + } + + actual := strings.TrimSpace(state.String()) + expected := strings.TrimSpace(` + + `) + if actual != expected { + t.Fatalf("bad: \n%s", actual) + } +} + func TestContext2Apply_moduleVarResourceCount(t *testing.T) { m := testModule(t, "apply-module-var-resource-count") p := testProvider("aws")