github.com/vtorhonen/terraform@v0.9.0-beta2.0.20170307220345-5d894e4ffda7/builtin/providers/google/import_google_project_test.go (about) 1 package google 2 3 import ( 4 "fmt" 5 "testing" 6 7 "github.com/hashicorp/terraform/helper/acctest" 8 "github.com/hashicorp/terraform/helper/resource" 9 ) 10 11 func TestAccGoogleProject_importBasic(t *testing.T) { 12 resourceName := "google_project.acceptance" 13 projectId := "terraform-" + acctest.RandString(10) 14 conf := testAccGoogleProject_import(projectId, org, pname) 15 16 resource.Test(t, resource.TestCase{ 17 PreCheck: func() { testAccPreCheck(t) }, 18 Providers: testAccProviders, 19 Steps: []resource.TestStep{ 20 resource.TestStep{ 21 Config: conf, 22 }, 23 24 resource.TestStep{ 25 ResourceName: resourceName, 26 ImportState: true, 27 ImportStateVerify: true, 28 }, 29 }, 30 }) 31 } 32 33 func testAccGoogleProject_import(pid, orgId, projectName string) string { 34 return fmt.Sprintf(` 35 resource "google_project" "acceptance" { 36 project_id = "%s" 37 org_id = "%s" 38 name = "%s" 39 }`, pid, orgId, projectName) 40 }