github.com/rstandt/terraform@v0.12.32-0.20230710220336-b1063613405c/builtin/providers/test/resource_nested_id_test.go (about)

     1  package test
     2  
     3  import (
     4  	"strings"
     5  	"testing"
     6  
     7  	"github.com/hashicorp/terraform/helper/resource"
     8  )
     9  
    10  func TestResourceNestedId_unknownId(t *testing.T) {
    11  	resource.UnitTest(t, resource.TestCase{
    12  		Providers:    testAccProviders,
    13  		CheckDestroy: testAccCheckResourceDestroy,
    14  		Steps: []resource.TestStep{
    15  			resource.TestStep{
    16  				Config: strings.TrimSpace(`
    17  resource "test_resource_nested_id" "foo" {
    18  }
    19  resource "test_resource_nested_id" "bar" {
    20  	list_block {
    21  		id = test_resource_nested_id.foo.id
    22  	}
    23  }
    24  				`),
    25  				Check: resource.ComposeTestCheckFunc(
    26  					resource.TestCheckResourceAttr("test_resource_nested_id.bar", "list_block.0.id", "testId"),
    27  				),
    28  			},
    29  		},
    30  	})
    31  }