2017-02-23 19:03:59 +01:00
|
|
|
package test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"strings"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/hashicorp/terraform/helper/resource"
|
|
|
|
"github.com/hashicorp/terraform/terraform"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Tests GH-12183. This would previously cause a crash. More granular
|
|
|
|
// unit tests are scattered through helper/schema and terraform core for
|
|
|
|
// this.
|
|
|
|
func TestResourceGH12183_basic(t *testing.T) {
|
|
|
|
resource.UnitTest(t, resource.TestCase{
|
|
|
|
Providers: testAccProviders,
|
|
|
|
CheckDestroy: testAccCheckResourceDestroy,
|
|
|
|
Steps: []resource.TestStep{
|
|
|
|
resource.TestStep{
|
|
|
|
Config: strings.TrimSpace(`
|
|
|
|
resource "test_resource_gh12183" "a" {
|
|
|
|
config {
|
|
|
|
name = "hello"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "test_resource_gh12183" "b" {
|
|
|
|
key = "${lookup(test_resource_gh12183.a.config[0], "name")}"
|
2018-10-16 03:17:27 +02:00
|
|
|
config {
|
|
|
|
name = "required"
|
|
|
|
}
|
2017-02-23 19:03:59 +01:00
|
|
|
}
|
|
|
|
`),
|
|
|
|
Check: func(s *terraform.State) error {
|
|
|
|
return nil
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
}
|