2016-08-04 22:14:43 +02:00
|
|
|
package google
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2017-06-06 14:20:29 +02:00
|
|
|
"fmt"
|
|
|
|
"github.com/hashicorp/terraform/helper/acctest"
|
2016-08-04 22:14:43 +02:00
|
|
|
"github.com/hashicorp/terraform/helper/resource"
|
|
|
|
)
|
|
|
|
|
2017-06-06 14:20:29 +02:00
|
|
|
func TestAccComputeAutoscaler_importBasic(t *testing.T) {
|
2016-08-04 22:14:43 +02:00
|
|
|
resourceName := "google_compute_autoscaler.foobar"
|
|
|
|
|
2017-06-06 14:20:29 +02:00
|
|
|
var it_name = fmt.Sprintf("autoscaler-test-%s", acctest.RandString(10))
|
|
|
|
var tp_name = fmt.Sprintf("autoscaler-test-%s", acctest.RandString(10))
|
|
|
|
var igm_name = fmt.Sprintf("autoscaler-test-%s", acctest.RandString(10))
|
|
|
|
var autoscaler_name = fmt.Sprintf("autoscaler-test-%s", acctest.RandString(10))
|
|
|
|
|
2016-08-04 22:14:43 +02:00
|
|
|
resource.Test(t, resource.TestCase{
|
|
|
|
PreCheck: func() { testAccPreCheck(t) },
|
|
|
|
Providers: testAccProviders,
|
2017-06-06 14:20:29 +02:00
|
|
|
CheckDestroy: testAccCheckComputeAutoscalerDestroy,
|
2016-08-04 22:14:43 +02:00
|
|
|
Steps: []resource.TestStep{
|
|
|
|
resource.TestStep{
|
2017-06-06 14:20:29 +02:00
|
|
|
Config: testAccComputeAutoscaler_basic(it_name, tp_name, igm_name, autoscaler_name),
|
2016-08-04 22:14:43 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
resource.TestStep{
|
|
|
|
ResourceName: resourceName,
|
|
|
|
ImportState: true,
|
|
|
|
ImportStateVerify: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
}
|