func testAccCheckDigitalOceanDropletRenamedAndResized(droplet *digitalocean.Droplet) resource.TestCheckFunc {
	return func(s *terraform.State) error {

		if droplet.SizeSlug() != "1gb" {
			return fmt.Errorf("Bad size_slug: %s", droplet.SizeSlug())
		}

		if droplet.Name != "baz" {
			return fmt.Errorf("Bad name: %s", droplet.Name)
		}

		return nil
	}
}
func testAccCheckDigitalOceanDropletAttributes(droplet *digitalocean.Droplet) resource.TestCheckFunc {
	return func(s *terraform.State) error {

		if droplet.ImageSlug() != "centos-5-8-x32" {
			return fmt.Errorf("Bad image_slug: %s", droplet.ImageSlug())
		}

		if droplet.SizeSlug != "512mb" {
			return fmt.Errorf("Bad size_slug: %s", droplet.SizeSlug)
		}

		if droplet.RegionSlug() != "nyc3" {
			return fmt.Errorf("Bad region_slug: %s", droplet.RegionSlug())
		}

		if droplet.Name != "foo" {
			return fmt.Errorf("Bad name: %s", droplet.Name)
		}
		return nil
	}
}
func resource_digitalocean_droplet_update_state(
	s *terraform.ResourceState,
	droplet *digitalocean.Droplet) (*terraform.ResourceState, error) {

	s.Attributes["name"] = droplet.Name
	s.Attributes["region"] = droplet.RegionSlug()

	if droplet.ImageSlug() == "" && droplet.ImageId() != "" {
		s.Attributes["image"] = droplet.ImageId()
	} else {
		s.Attributes["image"] = droplet.ImageSlug()
	}

	if droplet.IPV6Address("public") != "" {
		s.Attributes["ipv6"] = "true"
		s.Attributes["ipv6_address"] = droplet.IPV6Address("public")
		s.Attributes["ipv6_address_private"] = droplet.IPV6Address("private")
	}

	s.Attributes["ipv4_address"] = droplet.IPV4Address("public")
	s.Attributes["locked"] = droplet.IsLocked()

	if droplet.NetworkingType() == "private" {
		s.Attributes["private_networking"] = "true"
		s.Attributes["ipv4_address_private"] = droplet.IPV4Address("private")
	}

	s.Attributes["size"] = droplet.SizeSlug()
	s.Attributes["status"] = droplet.Status

	return s, nil
}
func testAccCheckDigitalOceanDropletAttributes_PrivateNetworkingIpv6(droplet *digitalocean.Droplet) resource.TestCheckFunc {
	return func(s *terraform.State) error {

		if droplet.ImageSlug() != "centos-5-8-x32" {
			return fmt.Errorf("Bad image_slug: %s", droplet.ImageSlug())
		}

		if droplet.SizeSlug != "1gb" {
			return fmt.Errorf("Bad size_slug: %s", droplet.SizeSlug)
		}

		if droplet.RegionSlug() != "sgp1" {
			return fmt.Errorf("Bad region_slug: %s", droplet.RegionSlug())
		}

		if droplet.Name != "baz" {
			return fmt.Errorf("Bad name: %s", droplet.Name)
		}

		if droplet.IPV4Address("private") == "" {
			return fmt.Errorf("No ipv4 private: %s", droplet.IPV4Address("private"))
		}

		// if droplet.IPV6Address("private") == "" {
		// 	return fmt.Errorf("No ipv6 private: %s", droplet.IPV6Address("private"))
		// }

		if droplet.NetworkingType() != "private" {
			return fmt.Errorf("Bad networking type: %s", droplet.NetworkingType())
		}

		if droplet.IPV4Address("public") == "" {
			return fmt.Errorf("No ipv4 public: %s", droplet.IPV4Address("public"))
		}

		if droplet.IPV6Address("public") == "" {
			return fmt.Errorf("No ipv6 public: %s", droplet.IPV6Address("public"))
		}

		return nil
	}
}