2016-12-01 19:38:27 +01:00
|
|
|
package google
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"testing"
|
|
|
|
|
2016-11-23 07:55:40 +01:00
|
|
|
"github.com/hashicorp/terraform/helper/acctest"
|
2016-12-01 19:38:27 +01:00
|
|
|
"github.com/hashicorp/terraform/helper/resource"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestAccGoogleProject_importBasic(t *testing.T) {
|
|
|
|
resourceName := "google_project.acceptance"
|
2016-11-23 07:55:40 +01:00
|
|
|
projectId := "terraform-" + acctest.RandString(10)
|
|
|
|
conf := testAccGoogleProject_import(projectId, org, pname)
|
2016-12-01 19:38:27 +01:00
|
|
|
|
|
|
|
resource.Test(t, resource.TestCase{
|
|
|
|
PreCheck: func() { testAccPreCheck(t) },
|
|
|
|
Providers: testAccProviders,
|
|
|
|
Steps: []resource.TestStep{
|
|
|
|
resource.TestStep{
|
|
|
|
Config: conf,
|
|
|
|
},
|
|
|
|
|
|
|
|
resource.TestStep{
|
|
|
|
ResourceName: resourceName,
|
|
|
|
ImportState: true,
|
|
|
|
ImportStateVerify: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
}
|
2016-11-23 07:55:40 +01:00
|
|
|
|
|
|
|
func testAccGoogleProject_import(pid, orgId, projectName string) string {
|
|
|
|
return fmt.Sprintf(`
|
|
|
|
resource "google_project" "acceptance" {
|
|
|
|
project_id = "%s"
|
|
|
|
org_id = "%s"
|
|
|
|
name = "%s"
|
|
|
|
}`, pid, orgId, projectName)
|
|
|
|
}
|