Skip to content

Commit 00a177c

Browse files
committed
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 hashicorp#2495
1 parent 2d6a8c1 commit 00a177c

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

‎terraform/context_test.go‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4423,6 +4423,37 @@ func TestContext2Apply_moduleProviderAlias(t *testing.T) {
44234423
}
44244424
}
44254425

4426+
func TestContext2Apply_moduleProviderAliasTargets(t *testing.T) {
4427+
m := testModule(t, "apply-module-provider-alias")
4428+
p := testProvider("aws")
4429+
p.ApplyFn = testApplyFn
4430+
p.DiffFn = testDiffFn
4431+
ctx := testContext2(t, &ContextOpts{
4432+
Module: m,
4433+
Providers: map[string]ResourceProviderFactory{
4434+
"aws": testProviderFuncFixed(p),
4435+
},
4436+
Targets: []string{"no.thing"},
4437+
})
4438+
4439+
if _, err := ctx.Plan(); err != nil {
4440+
t.Fatalf("err: %s", err)
4441+
}
4442+
4443+
state, err := ctx.Apply()
4444+
if err != nil {
4445+
t.Fatalf("err: %s", err)
4446+
}
4447+
4448+
actual := strings.TrimSpace(state.String())
4449+
expected := strings.TrimSpace(`
4450+
<no state>
4451+
`)
4452+
if actual != expected {
4453+
t.Fatalf("bad: \n%s", actual)
4454+
}
4455+
}
4456+
44264457
func TestContext2Apply_moduleVarResourceCount(t *testing.T) {
44274458
m := testModule(t, "apply-module-var-resource-count")
44284459
p := testProvider("aws")

0 commit comments

Comments
 (0)