diff --git a/google/import_compute_global_address_test.go b/google/import_compute_global_address_test.go deleted file mode 100644 index 7449ce87..00000000 --- a/google/import_compute_global_address_test.go +++ /dev/null @@ -1,30 +0,0 @@ -package google - -import ( - "testing" - - "github.com/hashicorp/terraform/helper/resource" -) - -func TestAccComputeGlobalAddress_importBasic(t *testing.T) { - t.Parallel() - - resourceName := "google_compute_global_address.foobar" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - CheckDestroy: testAccCheckComputeGlobalAddressDestroy, - Steps: []resource.TestStep{ - resource.TestStep{ - Config: testAccComputeGlobalAddress_basic(), - }, - - resource.TestStep{ - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} diff --git a/google/import_compute_health_check_test.go b/google/import_compute_health_check_test.go deleted file mode 100644 index 00469ede..00000000 --- a/google/import_compute_health_check_test.go +++ /dev/null @@ -1,104 +0,0 @@ -package google - -import ( - "testing" - - "fmt" - "github.com/hashicorp/terraform/helper/acctest" - "github.com/hashicorp/terraform/helper/resource" -) - -func TestAccComputeHealthCheck_importBasicHttp(t *testing.T) { - t.Parallel() - - resourceName := "google_compute_health_check.foobar" - hckName := fmt.Sprintf("tf-test-%s", acctest.RandString(10)) - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - CheckDestroy: testAccCheckComputeHealthCheckDestroy, - Steps: []resource.TestStep{ - resource.TestStep{ - Config: testAccComputeHealthCheck_http(hckName), - }, - - resource.TestStep{ - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - -func TestAccComputeHealthCheck_importBasicHttps(t *testing.T) { - t.Parallel() - - resourceName := "google_compute_health_check.foobar" - hckName := fmt.Sprintf("tf-test-%s", acctest.RandString(10)) - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - CheckDestroy: testAccCheckComputeHealthCheckDestroy, - Steps: []resource.TestStep{ - resource.TestStep{ - Config: testAccComputeHealthCheck_https(hckName), - }, - - resource.TestStep{ - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - -func TestAccComputeHealthCheck_importBasicTcp(t *testing.T) { - t.Parallel() - - resourceName := "google_compute_health_check.foobar" - hckName := fmt.Sprintf("tf-test-%s", acctest.RandString(10)) - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - CheckDestroy: testAccCheckComputeHealthCheckDestroy, - Steps: []resource.TestStep{ - resource.TestStep{ - Config: testAccComputeHealthCheck_tcp(hckName), - }, - - resource.TestStep{ - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} -func TestAccComputeHealthCheck_importBasicSsl(t *testing.T) { - t.Parallel() - - resourceName := "google_compute_health_check.foobar" - hckName := fmt.Sprintf("tf-test-%s", acctest.RandString(10)) - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - CheckDestroy: testAccCheckComputeHealthCheckDestroy, - Steps: []resource.TestStep{ - resource.TestStep{ - Config: testAccComputeHealthCheck_ssl(hckName), - }, - - resource.TestStep{ - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} diff --git a/google/import_compute_http_health_check_test.go b/google/import_compute_http_health_check_test.go deleted file mode 100644 index 9133d49e..00000000 --- a/google/import_compute_http_health_check_test.go +++ /dev/null @@ -1,34 +0,0 @@ -package google - -import ( - "testing" - - "fmt" - "github.com/hashicorp/terraform/helper/acctest" - "github.com/hashicorp/terraform/helper/resource" -) - -func TestAccComputeHttpHealthCheck_importBasic(t *testing.T) { - t.Parallel() - - resourceName := "google_compute_http_health_check.foobar" - - hhckName := fmt.Sprintf("tf-test-%s", acctest.RandString(10)) - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - CheckDestroy: testAccCheckComputeHttpHealthCheckDestroy, - Steps: []resource.TestStep{ - resource.TestStep{ - Config: testAccComputeHttpHealthCheck_basic(hhckName), - }, - - resource.TestStep{ - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} diff --git a/google/import_compute_https_health_check_test.go b/google/import_compute_https_health_check_test.go deleted file mode 100644 index be7d869c..00000000 --- a/google/import_compute_https_health_check_test.go +++ /dev/null @@ -1,30 +0,0 @@ -package google - -import ( - "fmt" - "github.com/hashicorp/terraform/helper/acctest" - "github.com/hashicorp/terraform/helper/resource" - "testing" -) - -func TestAccComputeHttpsHealthCheck_importBasic(t *testing.T) { - t.Parallel() - - hhckName := fmt.Sprintf("tf-test-%s", acctest.RandString(10)) - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - CheckDestroy: testAccCheckComputeHttpsHealthCheckDestroy, - Steps: []resource.TestStep{ - resource.TestStep{ - Config: testAccComputeHttpsHealthCheck_basic(hhckName), - }, - resource.TestStep{ - ResourceName: "google_compute_https_health_check.foobar", - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} diff --git a/google/import_compute_image_test.go b/google/import_compute_image_test.go deleted file mode 100644 index e9e83e68..00000000 --- a/google/import_compute_image_test.go +++ /dev/null @@ -1,49 +0,0 @@ -package google - -import ( - "testing" - - "github.com/hashicorp/terraform/helper/acctest" - "github.com/hashicorp/terraform/helper/resource" -) - -func TestAccComputeImage_importFromRawDisk(t *testing.T) { - t.Parallel() - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - CheckDestroy: testAccCheckComputeImageDestroy, - Steps: []resource.TestStep{ - resource.TestStep{ - Config: testAccComputeImage_basic("image-test-" + acctest.RandString(10)), - }, - resource.TestStep{ - ResourceName: "google_compute_image.foobar", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"raw_disk", "create_timeout"}, - }, - }, - }) -} - -func TestAccComputeImage_importFromSourceDisk(t *testing.T) { - t.Parallel() - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - CheckDestroy: testAccCheckComputeImageDestroy, - Steps: []resource.TestStep{ - resource.TestStep{ - Config: testAccComputeImage_basedondisk(), - }, - resource.TestStep{ - ResourceName: "google_compute_image.foobar", - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} diff --git a/google/import_compute_route_test.go b/google/import_compute_route_test.go deleted file mode 100644 index 3a8fff9c..00000000 --- a/google/import_compute_route_test.go +++ /dev/null @@ -1,49 +0,0 @@ -package google - -import ( - "testing" - - "github.com/hashicorp/terraform/helper/resource" -) - -func TestAccComputeRoute_importBasic(t *testing.T) { - t.Parallel() - resourceName := "google_compute_route.foobar" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - CheckDestroy: testAccCheckComputeRouteDestroy, - Steps: []resource.TestStep{ - { - Config: testAccComputeRoute_basic(), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - -func TestAccComputeRoute_importDefaultInternetGateway(t *testing.T) { - t.Parallel() - resourceName := "google_compute_route.foobar" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - CheckDestroy: testAccCheckComputeRouteDestroy, - Steps: []resource.TestStep{ - { - Config: testAccComputeRoute_defaultInternetGateway(), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} diff --git a/google/import_compute_router_test.go b/google/import_compute_router_test.go deleted file mode 100644 index dc44eec1..00000000 --- a/google/import_compute_router_test.go +++ /dev/null @@ -1,30 +0,0 @@ -package google - -import ( - "testing" - - "github.com/hashicorp/terraform/helper/resource" -) - -func TestAccComputeRouter_import(t *testing.T) { - t.Parallel() - - resourceName := "google_compute_router.foobar" - resourceRegion := "europe-west1" - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - CheckDestroy: testAccCheckComputeRouterDestroy, - Steps: []resource.TestStep{ - resource.TestStep{ - Config: testAccComputeRouterBasic(resourceRegion), - }, - - resource.TestStep{ - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} diff --git a/google/import_compute_subnetwork_test.go b/google/import_compute_subnetwork_test.go deleted file mode 100644 index d899dba7..00000000 --- a/google/import_compute_subnetwork_test.go +++ /dev/null @@ -1,38 +0,0 @@ -package google - -import ( - "fmt" - "github.com/hashicorp/terraform/helper/acctest" - "github.com/hashicorp/terraform/helper/resource" - "testing" -) - -func TestAccComputeSubnetwork_importBasic(t *testing.T) { - t.Parallel() - - cnName := fmt.Sprintf("tf-test-%s", acctest.RandString(10)) - subnetwork1Name := fmt.Sprintf("tf-test-%s", acctest.RandString(10)) - subnetwork2Name := fmt.Sprintf("tf-test-%s", acctest.RandString(10)) - subnetwork3Name := fmt.Sprintf("tf-test-%s", acctest.RandString(10)) - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - CheckDestroy: testAccCheckComputeSubnetworkDestroy, - Steps: []resource.TestStep{ - resource.TestStep{ - Config: testAccComputeSubnetwork_basic(cnName, subnetwork1Name, subnetwork2Name, subnetwork3Name), - }, - resource.TestStep{ - ResourceName: "google_compute_subnetwork.network-ref-by-url", - ImportState: true, - ImportStateVerify: true, - }, - resource.TestStep{ - ResourceName: "google_compute_subnetwork.network-with-private-google-access", - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} diff --git a/google/resource_compute_global_address_test.go b/google/resource_compute_global_address_test.go index 0bc0ad3d..d5e5290d 100644 --- a/google/resource_compute_global_address_test.go +++ b/google/resource_compute_global_address_test.go @@ -31,6 +31,11 @@ func TestAccComputeGlobalAddress_basic(t *testing.T) { testAccCheckComputeGlobalAddressIpVersion("google_compute_global_address.foobar", ""), ), }, + resource.TestStep{ + ResourceName: "google_compute_global_address.foobar", + ImportState: true, + ImportStateVerify: true, + }, }, }) } @@ -53,6 +58,11 @@ func TestAccComputeGlobalAddress_ipv6(t *testing.T) { testAccCheckComputeGlobalAddressIpVersion("google_compute_global_address.foobar", "IPV6"), ), }, + resource.TestStep{ + ResourceName: "google_compute_global_address.foobar", + ImportState: true, + ImportStateVerify: true, + }, }, }) } diff --git a/google/resource_compute_health_check_test.go b/google/resource_compute_health_check_test.go index d97d768b..506c3adf 100644 --- a/google/resource_compute_health_check_test.go +++ b/google/resource_compute_health_check_test.go @@ -33,6 +33,11 @@ func TestAccComputeHealthCheck_tcp(t *testing.T) { testAccCheckComputeHealthCheckTcpPort(80, &healthCheck), ), }, + resource.TestStep{ + ResourceName: "google_compute_health_check.foobar", + ImportState: true, + ImportStateVerify: true, + }, }, }) } @@ -94,6 +99,11 @@ func TestAccComputeHealthCheck_ssl(t *testing.T) { 3, 3, &healthCheck), ), }, + resource.TestStep{ + ResourceName: "google_compute_health_check.foobar", + ImportState: true, + ImportStateVerify: true, + }, }, }) } @@ -119,6 +129,11 @@ func TestAccComputeHealthCheck_http(t *testing.T) { 3, 3, &healthCheck), ), }, + resource.TestStep{ + ResourceName: "google_compute_health_check.foobar", + ImportState: true, + ImportStateVerify: true, + }, }, }) } @@ -144,6 +159,11 @@ func TestAccComputeHealthCheck_https(t *testing.T) { 3, 3, &healthCheck), ), }, + resource.TestStep{ + ResourceName: "google_compute_health_check.foobar", + ImportState: true, + ImportStateVerify: true, + }, }, }) } diff --git a/google/resource_compute_http_health_check_test.go b/google/resource_compute_http_health_check_test.go index 39319adf..cf12e72b 100644 --- a/google/resource_compute_http_health_check_test.go +++ b/google/resource_compute_http_health_check_test.go @@ -33,6 +33,11 @@ func TestAccComputeHttpHealthCheck_basic(t *testing.T) { 3, 3, &healthCheck), ), }, + resource.TestStep{ + ResourceName: "google_compute_http_health_check.foobar", + ImportState: true, + ImportStateVerify: true, + }, }, }) } diff --git a/google/resource_compute_https_health_check_test.go b/google/resource_compute_https_health_check_test.go index 5b43744e..ee32427f 100644 --- a/google/resource_compute_https_health_check_test.go +++ b/google/resource_compute_https_health_check_test.go @@ -33,6 +33,11 @@ func TestAccComputeHttpsHealthCheck_basic(t *testing.T) { 3, 3, &healthCheck), ), }, + resource.TestStep{ + ResourceName: "google_compute_https_health_check.foobar", + ImportState: true, + ImportStateVerify: true, + }, }, }) } diff --git a/google/resource_compute_image_test.go b/google/resource_compute_image_test.go index 72a0143a..5e65e254 100644 --- a/google/resource_compute_image_test.go +++ b/google/resource_compute_image_test.go @@ -69,6 +69,12 @@ func TestAccComputeImage_update(t *testing.T) { testAccCheckComputeImageHasComputedFingerprint(&image, "google_compute_image.foobar"), ), }, + resource.TestStep{ + ResourceName: "google_compute_image.foobar", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"raw_disk", "create_timeout"}, + }, }, }) } @@ -91,6 +97,11 @@ func TestAccComputeImage_basedondisk(t *testing.T) { testAccCheckComputeImageHasSourceDisk(&image), ), }, + resource.TestStep{ + ResourceName: "google_compute_image.foobar", + ImportState: true, + ImportStateVerify: true, + }, }, }) } diff --git a/google/resource_compute_route_test.go b/google/resource_compute_route_test.go index c9f1fece..2484b8ff 100644 --- a/google/resource_compute_route_test.go +++ b/google/resource_compute_route_test.go @@ -28,6 +28,11 @@ func TestAccComputeRoute_basic(t *testing.T) { "google_compute_route.foobar", &route), ), }, + resource.TestStep{ + ResourceName: "google_compute_route.foobar", + ImportState: true, + ImportStateVerify: true, + }, }, }) } @@ -49,6 +54,11 @@ func TestAccComputeRoute_defaultInternetGateway(t *testing.T) { "google_compute_route.foobar", &route), ), }, + resource.TestStep{ + ResourceName: "google_compute_route.foobar", + ImportState: true, + ImportStateVerify: true, + }, }, }) } @@ -74,6 +84,11 @@ func TestAccComputeRoute_hopInstance(t *testing.T) { resource.TestMatchResourceAttr("google_compute_route.foobar", "next_hop_instance", instanceNameRegexp), ), }, + resource.TestStep{ + ResourceName: "google_compute_route.foobar", + ImportState: true, + ImportStateVerify: true, + }, }, }) } diff --git a/google/resource_compute_router_test.go b/google/resource_compute_router_test.go index c3a39a62..3df0dad7 100644 --- a/google/resource_compute_router_test.go +++ b/google/resource_compute_router_test.go @@ -27,6 +27,11 @@ func TestAccComputeRouter_basic(t *testing.T) { "google_compute_router.foobar", "region", resourceRegion), ), }, + resource.TestStep{ + ResourceName: "google_compute_router.foobar", + ImportState: true, + ImportStateVerify: true, + }, }, }) } @@ -49,22 +54,10 @@ func TestAccComputeRouter_noRegion(t *testing.T) { "google_compute_router.foobar", "region", providerRegion), ), }, - }, - }) -} - -func TestAccComputeRouter_networkLink(t *testing.T) { - t.Parallel() - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - CheckDestroy: testAccCheckComputeRouterDestroy, - Steps: []resource.TestStep{ resource.TestStep{ - Config: testAccComputeRouterNetworkLink(), - Check: testAccCheckComputeRouterExists( - "google_compute_router.foobar"), + ResourceName: "google_compute_router.foobar", + ImportState: true, + ImportStateVerify: true, }, }, }) @@ -170,7 +163,7 @@ func testAccComputeRouterNoRegion(providerRegion string) string { } resource "google_compute_subnetwork" "foobar" { name = "router-test-subnetwork-%s" - network = "${google_compute_network.foobar.name}" + network = "${google_compute_network.foobar.self_link}" ip_cidr_range = "10.0.0.0/16" region = "%s" } @@ -183,26 +176,3 @@ func testAccComputeRouterNoRegion(providerRegion string) string { } `, testId, testId, providerRegion, testId) } - -func testAccComputeRouterNetworkLink() string { - testId := acctest.RandString(10) - return fmt.Sprintf(` - resource "google_compute_network" "foobar" { - name = "router-test-%s" - } - resource "google_compute_subnetwork" "foobar" { - name = "router-test-subnetwork-%s" - network = "${google_compute_network.foobar.self_link}" - ip_cidr_range = "10.0.0.0/16" - region = "europe-west1" - } - resource "google_compute_router" "foobar" { - name = "router-test-%s" - region = "${google_compute_subnetwork.foobar.region}" - network = "${google_compute_network.foobar.self_link}" - bgp { - asn = 64514 - } - } - `, testId, testId, testId) -} diff --git a/google/resource_compute_subnetwork_test.go b/google/resource_compute_subnetwork_test.go index 78bacb6b..da521df2 100644 --- a/google/resource_compute_subnetwork_test.go +++ b/google/resource_compute_subnetwork_test.go @@ -35,6 +35,16 @@ func TestAccComputeSubnetwork_basic(t *testing.T) { "google_compute_subnetwork.network-ref-by-name", &subnetwork2), ), }, + resource.TestStep{ + ResourceName: "google_compute_subnetwork.network-ref-by-url", + ImportState: true, + ImportStateVerify: true, + }, + resource.TestStep{ + ResourceName: "google_compute_subnetwork.network-with-private-google-access", + ImportState: true, + ImportStateVerify: true, + }, }, }) } @@ -74,7 +84,7 @@ func TestAccComputeSubnetwork_update(t *testing.T) { } } -func TestAccComputeSubnetwork_secondaryIpRangesUpdate(t *testing.T) { +func TestAccComputeSubnetwork_secondaryIpRanges(t *testing.T) { t.Parallel() var subnetwork compute.Subnetwork @@ -103,7 +113,7 @@ func TestAccComputeSubnetwork_secondaryIpRangesUpdate(t *testing.T) { ), }, resource.TestStep{ - Config: testAccComputeSubnetwork_secondaryIpRanges_update3(cnName, subnetworkName), + Config: testAccComputeSubnetwork_secondaryIpRanges_update1(cnName, subnetworkName), Check: resource.ComposeTestCheckFunc( testAccCheckComputeSubnetworkExists("google_compute_subnetwork.network-with-private-secondary-ip-ranges", &subnetwork), testAccCheckComputeSubnetworkHasSecondaryIpRange(&subnetwork, "tf-test-secondary-range-update1", "192.168.10.0/24"), @@ -114,30 +124,6 @@ func TestAccComputeSubnetwork_secondaryIpRangesUpdate(t *testing.T) { }) } -func TestAccComputeSubnetwork_secondaryIpRanges(t *testing.T) { - t.Parallel() - - var subnetwork compute.Subnetwork - - cnName := fmt.Sprintf("tf-test-%s", acctest.RandString(10)) - subnetworkName := fmt.Sprintf("tf-test-%s", acctest.RandString(10)) - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - CheckDestroy: testAccCheckComputeSubnetworkDestroy, - Steps: []resource.TestStep{ - resource.TestStep{ - Config: testAccComputeSubnetwork_secondaryIpRanges(cnName, subnetworkName), - Check: resource.ComposeTestCheckFunc( - testAccCheckComputeSubnetworkExists("google_compute_subnetwork.network-with-private-secondary-ip-range", &subnetwork), - testAccCheckComputeSubnetworkHasSecondaryIpRange(&subnetwork, "tf-test-secondary-range", "192.168.1.0/24"), - ), - }, - }, - }) -} - func testAccCheckComputeSubnetworkDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) @@ -281,26 +267,6 @@ resource "google_compute_subnetwork" "network-with-private-google-access" { `, cnName, subnetworkName) } -func testAccComputeSubnetwork_secondaryIpRanges(cnName, subnetworkName string) string { - return fmt.Sprintf(` -resource "google_compute_network" "custom-test" { - name = "%s" - auto_create_subnetworks = false -} - -resource "google_compute_subnetwork" "network-with-private-secondary-ip-range" { - name = "%s" - ip_cidr_range = "10.2.0.0/16" - region = "us-central1" - network = "${google_compute_network.custom-test.self_link}" - secondary_ip_range { - range_name = "tf-test-secondary-range" - ip_cidr_range = "192.168.1.0/24" - } -} -`, cnName, subnetworkName) -} - func testAccComputeSubnetwork_secondaryIpRanges_update1(cnName, subnetworkName string) string { return fmt.Sprintf(` resource "google_compute_network" "custom-test" { @@ -344,23 +310,3 @@ resource "google_compute_subnetwork" "network-with-private-secondary-ip-ranges" } `, cnName, subnetworkName) } - -func testAccComputeSubnetwork_secondaryIpRanges_update3(cnName, subnetworkName string) string { - return fmt.Sprintf(` -resource "google_compute_network" "custom-test" { - name = "%s" - auto_create_subnetworks = false -} - -resource "google_compute_subnetwork" "network-with-private-secondary-ip-ranges" { - name = "%s" - ip_cidr_range = "10.2.0.0/16" - region = "us-central1" - network = "${google_compute_network.custom-test.self_link}" - secondary_ip_range { - range_name = "tf-test-secondary-range-update1" - ip_cidr_range = "192.168.10.0/24" - } -} -`, cnName, subnetworkName) -}