|
|
|
|
@ -4128,6 +4128,48 @@ func TestContext2Apply_nilDiff(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestContext2Apply_outputOrphan(t *testing.T) {
|
|
|
|
|
m := testModule(t, "apply-output-orphan")
|
|
|
|
|
p := testProvider("aws")
|
|
|
|
|
p.ApplyFn = testApplyFn
|
|
|
|
|
p.DiffFn = testDiffFn
|
|
|
|
|
|
|
|
|
|
state := &State{
|
|
|
|
|
Modules: []*ModuleState{
|
|
|
|
|
&ModuleState{
|
|
|
|
|
Path: rootModulePath,
|
|
|
|
|
Outputs: map[string]string{
|
|
|
|
|
"foo": "bar",
|
|
|
|
|
"bar": "baz",
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ctx := testContext2(t, &ContextOpts{
|
|
|
|
|
Module: m,
|
|
|
|
|
Providers: map[string]ResourceProviderFactory{
|
|
|
|
|
"aws": testProviderFuncFixed(p),
|
|
|
|
|
},
|
|
|
|
|
State: state,
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
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(testTerraformApplyOutputOrphanStr)
|
|
|
|
|
if actual != expected {
|
|
|
|
|
t.Fatalf("bad: \n%s", actual)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestContext2Apply_Provisioner_compute(t *testing.T) {
|
|
|
|
|
m := testModule(t, "apply-provisioner-compute")
|
|
|
|
|
p := testProvider("aws")
|
|
|
|
|
|