terraform: error if resource not found in module [GH-1997]
This commit is contained in:
parent
38efe4cb80
commit
fcc710ca06
|
@ -6559,6 +6559,23 @@ func TestContext2Apply_unknownAttribute(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestContext2Apply_unknownAttributeInterpolate(t *testing.T) {
|
||||||
|
m := testModule(t, "apply-unknown-interpolate")
|
||||||
|
p := testProvider("aws")
|
||||||
|
p.ApplyFn = testApplyFn
|
||||||
|
p.DiffFn = testDiffFn
|
||||||
|
ctx := testContext2(t, &ContextOpts{
|
||||||
|
Module: m,
|
||||||
|
Providers: map[string]ResourceProviderFactory{
|
||||||
|
"aws": testProviderFuncFixed(p),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
if _, err := ctx.Plan(); err == nil {
|
||||||
|
t.Fatal("should error")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestContext2Apply_vars(t *testing.T) {
|
func TestContext2Apply_vars(t *testing.T) {
|
||||||
m := testModule(t, "apply-vars")
|
m := testModule(t, "apply-vars")
|
||||||
p := testProvider("aws")
|
p := testProvider("aws")
|
||||||
|
|
|
@ -362,7 +362,7 @@ MISSING:
|
||||||
// Validation for missing interpolations should happen at a higher
|
// Validation for missing interpolations should happen at a higher
|
||||||
// semantic level. If we reached this point and don't have variables,
|
// semantic level. If we reached this point and don't have variables,
|
||||||
// just return the computed value.
|
// just return the computed value.
|
||||||
if scope == nil || scope.Resource == nil {
|
if scope == nil && scope.Resource == nil {
|
||||||
return config.UnknownVariableValue, nil
|
return config.UnknownVariableValue, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
variable "value" {}
|
|
@ -0,0 +1,6 @@
|
||||||
|
resource "aws_instance" "foo" {}
|
||||||
|
|
||||||
|
module "child" {
|
||||||
|
source = "./child"
|
||||||
|
value = "${aws_instance.foo.nope}"
|
||||||
|
}
|
Loading…
Reference in New Issue