core: Fix TestContext2Apply_provisionerDestroyRefInvalid

This test was relying on an odd definition of "invalid" from prior
versions of Terraform, where it would be an error to access an attribute
that exists as part of the resource type schema but the provider
implementation neglected to set it.

This was an implementation detail though, caused by the flatmap
representation and the fact that core itself didn't have access to the
schema to do static validation. Now the original usage returns a null
value because the "value" attribute is defined, and so we need a new
test fixture that accesses an attribute that is not defined in the schema
at all.
This commit is contained in:
Martin Atkins 2018-09-21 10:52:11 -07:00
parent faddb83a92
commit da20613deb
2 changed files with 13 additions and 1 deletions

View File

@ -5396,7 +5396,7 @@ func TestContext2Apply_provisionerDestroyRef(t *testing.T) {
// Test that a destroy provisioner referencing an invalid key errors. // Test that a destroy provisioner referencing an invalid key errors.
func TestContext2Apply_provisionerDestroyRefInvalid(t *testing.T) { func TestContext2Apply_provisionerDestroyRefInvalid(t *testing.T) {
m := testModule(t, "apply-provisioner-destroy-ref") m := testModule(t, "apply-provisioner-destroy-ref-invalid")
p := testProvider("aws") p := testProvider("aws")
pr := testProvisioner() pr := testProvisioner()
p.ApplyFn = testApplyFn p.ApplyFn = testApplyFn

View File

@ -0,0 +1,12 @@
resource "aws_instance" "bar" {
value = "hello"
}
resource "aws_instance" "foo" {
foo = "bar"
provisioner "shell" {
command = aws_instance.bar.does_not_exist
when = "destroy"
}
}