mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-30 10:47:14 -06:00
411df99f33
Nested structures may have "id" fields, which should be treated normally.
32 lines
671 B
Go
32 lines
671 B
Go
package test
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
|
|
"github.com/hashicorp/terraform/helper/resource"
|
|
)
|
|
|
|
func TestResourceNestedId_unknownId(t *testing.T) {
|
|
resource.UnitTest(t, resource.TestCase{
|
|
Providers: testAccProviders,
|
|
CheckDestroy: testAccCheckResourceDestroy,
|
|
Steps: []resource.TestStep{
|
|
resource.TestStep{
|
|
Config: strings.TrimSpace(`
|
|
resource "test_resource_nested_id" "foo" {
|
|
}
|
|
resource "test_resource_nested_id" "bar" {
|
|
list_block {
|
|
id = test_resource_nested_id.foo.id
|
|
}
|
|
}
|
|
`),
|
|
Check: resource.ComposeTestCheckFunc(
|
|
resource.TestCheckResourceAttr("test_resource_nested_id.bar", "list_block.0.id", "testId"),
|
|
),
|
|
},
|
|
},
|
|
})
|
|
}
|