Merge pull request #12837 from hashicorp/b-interpolate
terraform: unknown value for variables not set
This commit is contained in:
commit
2698194f64
|
@ -60,6 +60,32 @@ func TestContext2Refresh(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestContext2Refresh_dataComputedModuleVar(t *testing.T) {
|
||||
p := testProvider("aws")
|
||||
m := testModule(t, "refresh-data-module-var")
|
||||
ctx := testContext2(t, &ContextOpts{
|
||||
Module: m,
|
||||
Providers: map[string]ResourceProviderFactory{
|
||||
"aws": testProviderFuncFixed(p),
|
||||
},
|
||||
})
|
||||
|
||||
p.RefreshFn = nil
|
||||
p.RefreshReturn = &InstanceState{
|
||||
ID: "foo",
|
||||
}
|
||||
|
||||
s, err := ctx.Refresh()
|
||||
if err != nil {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
|
||||
checkStateString(t, s, `
|
||||
<no state>
|
||||
module.child:
|
||||
<no state>`)
|
||||
}
|
||||
|
||||
func TestContext2Refresh_targeted(t *testing.T) {
|
||||
p := testProvider("aws")
|
||||
m := testModule(t, "refresh-targeted")
|
||||
|
|
|
@ -262,7 +262,7 @@ func (i *Interpolater) valueResourceVar(
|
|||
// If it truly is missing, we'll catch it on a later walk.
|
||||
// This applies only to graph nodes that interpolate during the
|
||||
// config walk, e.g. providers.
|
||||
if i.Operation == walkInput {
|
||||
if i.Operation == walkInput || i.Operation == walkRefresh {
|
||||
result[n] = unknownVariable()
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
variable "key" {}
|
||||
|
||||
data "aws_data_source" "foo" {
|
||||
id = "${var.key}"
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
resource "aws_instance" "A" {
|
||||
foo = "bar"
|
||||
}
|
||||
|
||||
module "child" {
|
||||
source = "child"
|
||||
key = "${aws_instance.A.id}"
|
||||
}
|
Loading…
Reference in New Issue