File tree Expand file tree Collapse file tree 1 file changed +48
-0
lines changed
helper/resource/importstate Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Original file line number Diff line number Diff line change 1+ // Copyright (c) HashiCorp, Inc.
2+ // SPDX-License-Identifier: MPL-2.0
3+
4+ package importstate_test
5+
6+ import (
7+ "testing"
8+
9+ "github.com/hashicorp/terraform-plugin-go/tfprotov6"
10+
11+ "github.com/hashicorp/terraform-plugin-testing/internal/testing/testprovider"
12+ "github.com/hashicorp/terraform-plugin-testing/internal/testing/testsdk/providerserver"
13+ "github.com/hashicorp/terraform-plugin-testing/tfversion"
14+
15+ r "github.com/hashicorp/terraform-plugin-testing/helper/resource"
16+ )
17+
18+ func Test_ImportBlock_VerifyPlan (t * testing.T ) {
19+ t .Parallel ()
20+
21+ r .UnitTest (t , r.TestCase {
22+ TerraformVersionChecks : []tfversion.TerraformVersionCheck {
23+ tfversion .SkipBelow (tfversion .Version1_5_0 ), // ImportBlockWithID requires Terraform 1.5.0 or later
24+ },
25+ ProtoV6ProviderFactories : map [string ]func () (tfprotov6.ProviderServer , error ){
26+ "examplecloud" : providerserver .NewProviderServer (testprovider.Provider {
27+ Resources : map [string ]testprovider.Resource {
28+ "examplecloud_container" : examplecloudResource (),
29+ },
30+ }),
31+ },
32+ Steps : []r.TestStep {
33+ {
34+ Config : `
35+ resource "examplecloud_container" "test" {
36+ location = "westeurope"
37+ name = "somevalue"
38+ }` ,
39+ },
40+ {
41+ ResourceName : "examplecloud_container.test" ,
42+ ImportState : true ,
43+ ImportStateKind : r .ImportBlockWithID ,
44+ ImportPlanVerify : true ,
45+ },
46+ },
47+ })
48+ }
You can’t perform that action at this time.
0 commit comments