mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-09-06 00:56:43 +00:00
66 lines
1.9 KiB
Go
66 lines
1.9 KiB
Go
![]() |
package google
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"testing"
|
||
|
|
||
|
"github.com/hashicorp/terraform/helper/acctest"
|
||
|
"github.com/hashicorp/terraform/helper/resource"
|
||
|
)
|
||
|
|
||
|
func TestAccInstanceGroupManager_importBasic(t *testing.T) {
|
||
|
resourceName1 := "google_compute_instance_group_manager.igm-basic"
|
||
|
resourceName2 := "google_compute_instance_group_manager.igm-no-tp"
|
||
|
template := fmt.Sprintf("igm-test-%s", acctest.RandString(10))
|
||
|
target := fmt.Sprintf("igm-test-%s", acctest.RandString(10))
|
||
|
igm1 := fmt.Sprintf("igm-test-%s", acctest.RandString(10))
|
||
|
igm2 := fmt.Sprintf("igm-test-%s", acctest.RandString(10))
|
||
|
|
||
|
resource.Test(t, resource.TestCase{
|
||
|
PreCheck: func() { testAccPreCheck(t) },
|
||
|
Providers: testAccProviders,
|
||
|
CheckDestroy: testAccCheckInstanceGroupManagerDestroy,
|
||
|
Steps: []resource.TestStep{
|
||
|
resource.TestStep{
|
||
|
Config: testAccInstanceGroupManager_basic(template, target, igm1, igm2),
|
||
|
},
|
||
|
|
||
|
resource.TestStep{
|
||
|
ResourceName: resourceName1,
|
||
|
ImportState: true,
|
||
|
ImportStateVerify: true,
|
||
|
},
|
||
|
|
||
|
resource.TestStep{
|
||
|
ResourceName: resourceName2,
|
||
|
ImportState: true,
|
||
|
ImportStateVerify: true,
|
||
|
},
|
||
|
},
|
||
|
})
|
||
|
}
|
||
|
|
||
|
func TestAccInstanceGroupManager_importUpdate(t *testing.T) {
|
||
|
resourceName := "google_compute_instance_group_manager.igm-update"
|
||
|
template := fmt.Sprintf("igm-test-%s", acctest.RandString(10))
|
||
|
target := fmt.Sprintf("igm-test-%s", acctest.RandString(10))
|
||
|
igm := fmt.Sprintf("igm-test-%s", acctest.RandString(10))
|
||
|
|
||
|
resource.Test(t, resource.TestCase{
|
||
|
PreCheck: func() { testAccPreCheck(t) },
|
||
|
Providers: testAccProviders,
|
||
|
CheckDestroy: testAccCheckInstanceGroupManagerDestroy,
|
||
|
Steps: []resource.TestStep{
|
||
|
resource.TestStep{
|
||
|
Config: testAccInstanceGroupManager_update(template, target, igm),
|
||
|
},
|
||
|
|
||
|
resource.TestStep{
|
||
|
ResourceName: resourceName,
|
||
|
ImportState: true,
|
||
|
ImportStateVerify: true,
|
||
|
},
|
||
|
},
|
||
|
})
|
||
|
}
|