Merge pull request #10469 from hashicorp/paddy_10425_import_projects

providers/google: make projects importable.
This commit is contained in:
Paddy 2016-12-01 15:13:16 -08:00 committed by GitHub
commit ce89d6ca9d
3 changed files with 33 additions and 0 deletions

View File

@ -0,0 +1,29 @@
package google
import (
"fmt"
"testing"
"github.com/hashicorp/terraform/helper/resource"
)
func TestAccGoogleProject_importBasic(t *testing.T) {
resourceName := "google_project.acceptance"
conf := fmt.Sprintf(testAccGoogleProject_basic, projectId)
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,
},
},
})
}

View File

@ -29,6 +29,9 @@ func resourceGoogleProject() *schema.Resource {
Read: resourceGoogleProjectRead,
Update: resourceGoogleProjectUpdate,
Delete: resourceGoogleProjectDelete,
Importer: &schema.ResourceImporter{
State: schema.ImportStatePassthrough,
},
Schema: map[string]*schema.Schema{
"id": &schema.Schema{

View File

@ -135,6 +135,7 @@ To make a resource importable, please see the
* google_compute_instance_group_manager
* google_compute_instance_template
* google_compute_target_pool
* google_project
### OpenStack