github.com/danp/terraform@v0.9.5-0.20170426144147-39d740081351/builtin/providers/test/resource_gh12183_test.go (about) 1 package test 2 3 import ( 4 "strings" 5 "testing" 6 7 "github.com/hashicorp/terraform/helper/resource" 8 "github.com/hashicorp/terraform/terraform" 9 ) 10 11 // Tests GH-12183. This would previously cause a crash. More granular 12 // unit tests are scattered through helper/schema and terraform core for 13 // this. 14 func TestResourceGH12183_basic(t *testing.T) { 15 resource.UnitTest(t, resource.TestCase{ 16 Providers: testAccProviders, 17 CheckDestroy: testAccCheckResourceDestroy, 18 Steps: []resource.TestStep{ 19 resource.TestStep{ 20 Config: strings.TrimSpace(` 21 resource "test_resource_gh12183" "a" { 22 config { 23 name = "hello" 24 } 25 } 26 27 resource "test_resource_gh12183" "b" { 28 key = "${lookup(test_resource_gh12183.a.config[0], "name")}" 29 } 30 `), 31 Check: func(s *terraform.State) error { 32 return nil 33 }, 34 }, 35 }, 36 }) 37 }