diff --git a/builtin/providers/digitalocean/resource_digitalocean_droplet.go b/builtin/providers/digitalocean/resource_digitalocean_droplet.go index a44f3eb3a2..a33e20d881 100644 --- a/builtin/providers/digitalocean/resource_digitalocean_droplet.go +++ b/builtin/providers/digitalocean/resource_digitalocean_droplet.go @@ -76,6 +76,9 @@ func resourceDigitalOceanDroplet() *schema.Resource { "ipv6_address": &schema.Schema{ Type: schema.TypeString, Computed: true, + StateFunc: func(val interface{}) string { + return strings.ToLower(val.(string)) + }, }, "ipv6_address_private": &schema.Schema{ @@ -253,7 +256,7 @@ func resourceDigitalOceanDropletRead(d *schema.ResourceData, meta interface{}) e if publicIPv6 := findIPv6AddrByType(droplet, "public"); publicIPv6 != "" { d.Set("ipv6", true) - d.Set("ipv6_address", publicIPv6) + d.Set("ipv6_address", strings.ToLower(publicIPv6)) d.Set("ipv6_address_private", findIPv6AddrByType(droplet, "private")) } diff --git a/builtin/providers/digitalocean/resource_digitalocean_droplet_test.go b/builtin/providers/digitalocean/resource_digitalocean_droplet_test.go index d6f2b190d3..9ac1473c1a 100644 --- a/builtin/providers/digitalocean/resource_digitalocean_droplet_test.go +++ b/builtin/providers/digitalocean/resource_digitalocean_droplet_test.go @@ -260,6 +260,16 @@ func testAccCheckDigitalOceanDropletAttributes_PrivateNetworkingIpv6(droplet *go return fmt.Errorf("No ipv6 public: %s", findIPv6AddrByType(droplet, "public")) } + for _, rs := range s.RootModule().Resources { + if rs.Type != "digitalocean_droplet" { + continue + } + if rs.Primary.Attributes["ipv6_address"] != strings.ToLower(findIPv6AddrByType(droplet, "public")) { + return fmt.Errorf("IPV6 Address should be lowercase") + } + + } + return nil } }