diff --git a/builtin/providers/google/resource_compute_address_test.go b/builtin/providers/google/resource_compute_address_test.go index e0c576aee..ba87169d6 100644 --- a/builtin/providers/google/resource_compute_address_test.go +++ b/builtin/providers/google/resource_compute_address_test.go @@ -31,13 +31,13 @@ func TestAccComputeAddress_basic(t *testing.T) { func testAccCheckComputeAddressDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - for _, rs := range s.Resources { + for _, rs := range s.RootModule().Resources { if rs.Type != "google_compute_address" { continue } _, err := config.clientCompute.Addresses.Get( - config.Project, config.Region, rs.ID).Do() + config.Project, config.Region, rs.Primary.ID).Do() if err == nil { return fmt.Errorf("Address still exists") } @@ -48,24 +48,24 @@ func testAccCheckComputeAddressDestroy(s *terraform.State) error { func testAccCheckComputeAddressExists(n string, addr *compute.Address) resource.TestCheckFunc { return func(s *terraform.State) error { - rs, ok := s.Resources[n] + rs, ok := s.RootModule().Resources[n] if !ok { return fmt.Errorf("Not found: %s", n) } - if rs.ID == "" { + if rs.Primary.ID == "" { return fmt.Errorf("No ID is set") } config := testAccProvider.Meta().(*Config) found, err := config.clientCompute.Addresses.Get( - config.Project, config.Region, rs.ID).Do() + config.Project, config.Region, rs.Primary.ID).Do() if err != nil { return err } - if found.Name != rs.ID { + if found.Name != rs.Primary.ID { return fmt.Errorf("Addr not found") } diff --git a/builtin/providers/google/resource_compute_disk_test.go b/builtin/providers/google/resource_compute_disk_test.go index 188741fa6..04853e4e8 100644 --- a/builtin/providers/google/resource_compute_disk_test.go +++ b/builtin/providers/google/resource_compute_disk_test.go @@ -31,13 +31,13 @@ func TestAccComputeDisk_basic(t *testing.T) { func testAccCheckComputeDiskDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - for _, rs := range s.Resources { + for _, rs := range s.RootModule().Resources { if rs.Type != "google_compute_disk" { continue } _, err := config.clientCompute.Disks.Get( - config.Project, rs.Attributes["zone"], rs.ID).Do() + config.Project, rs.Primary.Attributes["zone"], rs.Primary.ID).Do() if err == nil { return fmt.Errorf("Disk still exists") } @@ -48,24 +48,24 @@ func testAccCheckComputeDiskDestroy(s *terraform.State) error { func testAccCheckComputeDiskExists(n string, disk *compute.Disk) resource.TestCheckFunc { return func(s *terraform.State) error { - rs, ok := s.Resources[n] + rs, ok := s.RootModule().Resources[n] if !ok { return fmt.Errorf("Not found: %s", n) } - if rs.ID == "" { + if rs.Primary.ID == "" { return fmt.Errorf("No ID is set") } config := testAccProvider.Meta().(*Config) found, err := config.clientCompute.Disks.Get( - config.Project, rs.Attributes["zone"], rs.ID).Do() + config.Project, rs.Primary.Attributes["zone"], rs.Primary.ID).Do() if err != nil { return err } - if found.Name != rs.ID { + if found.Name != rs.Primary.ID { return fmt.Errorf("Disk not found") } diff --git a/builtin/providers/google/resource_compute_firewall_test.go b/builtin/providers/google/resource_compute_firewall_test.go index a801bd86b..58a6fd787 100644 --- a/builtin/providers/google/resource_compute_firewall_test.go +++ b/builtin/providers/google/resource_compute_firewall_test.go @@ -59,13 +59,13 @@ func TestAccComputeFirewall_update(t *testing.T) { func testAccCheckComputeFirewallDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - for _, rs := range s.Resources { + for _, rs := range s.RootModule().Resources { if rs.Type != "google_compute_firewall" { continue } _, err := config.clientCompute.Firewalls.Get( - config.Project, rs.ID).Do() + config.Project, rs.Primary.ID).Do() if err == nil { return fmt.Errorf("Firewall still exists") } @@ -76,24 +76,24 @@ func testAccCheckComputeFirewallDestroy(s *terraform.State) error { func testAccCheckComputeFirewallExists(n string, firewall *compute.Firewall) resource.TestCheckFunc { return func(s *terraform.State) error { - rs, ok := s.Resources[n] + rs, ok := s.RootModule().Resources[n] if !ok { return fmt.Errorf("Not found: %s", n) } - if rs.ID == "" { + if rs.Primary.ID == "" { return fmt.Errorf("No ID is set") } config := testAccProvider.Meta().(*Config) found, err := config.clientCompute.Firewalls.Get( - config.Project, rs.ID).Do() + config.Project, rs.Primary.ID).Do() if err != nil { return err } - if found.Name != rs.ID { + if found.Name != rs.Primary.ID { return fmt.Errorf("Firewall not found") } diff --git a/builtin/providers/google/resource_compute_instance_test.go b/builtin/providers/google/resource_compute_instance_test.go index af996763e..8759cf94f 100644 --- a/builtin/providers/google/resource_compute_instance_test.go +++ b/builtin/providers/google/resource_compute_instance_test.go @@ -106,13 +106,13 @@ func TestAccComputeInstance_update(t *testing.T) { func testAccCheckComputeInstanceDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - for _, rs := range s.Resources { + for _, rs := range s.RootModule().Resources { if rs.Type != "google_compute_instance" { continue } _, err := config.clientCompute.Instances.Get( - config.Project, rs.Attributes["zone"], rs.ID).Do() + config.Project, rs.Primary.Attributes["zone"], rs.Primary.ID).Do() if err == nil { return fmt.Errorf("Instance still exists") } @@ -123,24 +123,24 @@ func testAccCheckComputeInstanceDestroy(s *terraform.State) error { func testAccCheckComputeInstanceExists(n string, instance *compute.Instance) resource.TestCheckFunc { return func(s *terraform.State) error { - rs, ok := s.Resources[n] + rs, ok := s.RootModule().Resources[n] if !ok { return fmt.Errorf("Not found: %s", n) } - if rs.ID == "" { + if rs.Primary.ID == "" { return fmt.Errorf("No ID is set") } config := testAccProvider.Meta().(*Config) found, err := config.clientCompute.Instances.Get( - config.Project, rs.Attributes["zone"], rs.ID).Do() + config.Project, rs.Primary.Attributes["zone"], rs.Primary.ID).Do() if err != nil { return err } - if found.Name != rs.ID { + if found.Name != rs.Primary.ID { return fmt.Errorf("Instance not found") } diff --git a/builtin/providers/google/resource_compute_network_test.go b/builtin/providers/google/resource_compute_network_test.go index 60c278117..ea25b0ff4 100644 --- a/builtin/providers/google/resource_compute_network_test.go +++ b/builtin/providers/google/resource_compute_network_test.go @@ -31,13 +31,13 @@ func TestAccComputeNetwork_basic(t *testing.T) { func testAccCheckComputeNetworkDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - for _, rs := range s.Resources { + for _, rs := range s.RootModule().Resources { if rs.Type != "google_compute_network" { continue } _, err := config.clientCompute.Networks.Get( - config.Project, rs.ID).Do() + config.Project, rs.Primary.ID).Do() if err == nil { return fmt.Errorf("Network still exists") } @@ -48,24 +48,24 @@ func testAccCheckComputeNetworkDestroy(s *terraform.State) error { func testAccCheckComputeNetworkExists(n string, network *compute.Network) resource.TestCheckFunc { return func(s *terraform.State) error { - rs, ok := s.Resources[n] + rs, ok := s.RootModule().Resources[n] if !ok { return fmt.Errorf("Not found: %s", n) } - if rs.ID == "" { + if rs.Primary.ID == "" { return fmt.Errorf("No ID is set") } config := testAccProvider.Meta().(*Config) found, err := config.clientCompute.Networks.Get( - config.Project, rs.ID).Do() + config.Project, rs.Primary.ID).Do() if err != nil { return err } - if found.Name != rs.ID { + if found.Name != rs.Primary.ID { return fmt.Errorf("Network not found") } diff --git a/builtin/providers/google/resource_compute_route_test.go b/builtin/providers/google/resource_compute_route_test.go index eb0721d96..065842f85 100644 --- a/builtin/providers/google/resource_compute_route_test.go +++ b/builtin/providers/google/resource_compute_route_test.go @@ -31,13 +31,13 @@ func TestAccComputeRoute_basic(t *testing.T) { func testAccCheckComputeRouteDestroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) - for _, rs := range s.Resources { + for _, rs := range s.RootModule().Resources { if rs.Type != "google_compute_route" { continue } _, err := config.clientCompute.Routes.Get( - config.Project, rs.ID).Do() + config.Project, rs.Primary.ID).Do() if err == nil { return fmt.Errorf("Route still exists") } @@ -48,24 +48,24 @@ func testAccCheckComputeRouteDestroy(s *terraform.State) error { func testAccCheckComputeRouteExists(n string, route *compute.Route) resource.TestCheckFunc { return func(s *terraform.State) error { - rs, ok := s.Resources[n] + rs, ok := s.RootModule().Resources[n] if !ok { return fmt.Errorf("Not found: %s", n) } - if rs.ID == "" { + if rs.Primary.ID == "" { return fmt.Errorf("No ID is set") } config := testAccProvider.Meta().(*Config) found, err := config.clientCompute.Routes.Get( - config.Project, rs.ID).Do() + config.Project, rs.Primary.ID).Do() if err != nil { return err } - if found.Name != rs.ID { + if found.Name != rs.Primary.ID { return fmt.Errorf("Route not found") }