When you specify the ID of an image that has a slug, terraform would
store its slug to the state, hence it would always recreate the image.
This commit fixes it by storing the image as an ID when it is specified
by and ID by the user, ignoring the slug.
Closes#12751.
Fixes#12255.
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
Allow to resize a droplet permanently (i.e. apply disk resize)
if previously it was resized temporarily (CPU and RAM only).
Fixes: #13007
```
$ make testacc TEST=./builtin/providers/digitalocean TESTARGS='-run=TestAccDigitalOceanDroplet_ResizeOnlyDisk'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2017/03/25 03:54:23 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/digitalocean -v -run=TestAccDigitalOceanDroplet_ResizeOnlyDisk -timeout 120m
=== RUN TestAccDigitalOceanDroplet_ResizeOnlyDisk
--- PASS: TestAccDigitalOceanDroplet_ResizeOnlyDisk (198.62s)
PASS
ok github.com/hashicorp/terraform/builtin/providers/digitalocean 198.638s
```
Fixes failing acceptance test:
```
$ make testacc TEST=./builtin/providers/digitalocean TESTARGS='-run=TestAccDigitalOceanVolume_Droplet'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2017/01/20 11:38:26 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/digitalocean -v -run=TestAccDigitalOceanVolume_Droplet -timeout 120m
=== RUN TestAccDigitalOceanVolume_Droplet
--- PASS: TestAccDigitalOceanVolume_Droplet (57.38s)
PASS
ok github.com/hashicorp/terraform/builtin/providers/digitalocean 57.411s
```
Also removes all redundant type declarations in the digitalocean package.
IPV6 Addresses are generally case insensitive but it is recommented to
store them as lowercase (https://tools.ietf.org/html/rfc5952#section-4.3)
When Terraform didn't store them as LowerCase, we got the following
error when using in DNS records:
```
-/+ digitalocean_record.web6
domain: "mydomain.com" => "mydomain.com"
fqdn: "web02.in.mydomain.com" => "<computed>"
name: "web02.in" => "web02.in"
port: "0" => "<computed>"
priority: "0" => "<computed>"
type: "AAAA" => "AAAA"
value: "2a03:b0c0:0003:00d0:0000:0000:0b66:6001" => "2A03:B0C0:0003:00D0:0000:0000:0B66:6001" (forces new resource)
weight: "0" => "<computed>"
```
There was no need for this to be the case. We now enforce lowercase on both state and also when responses are returned from the API
The region returned by the API is always lowercase therefore when you specify a region uppercase in your config file it forces the droplet to be regenerated on every ```terraform apply``` (even when it is not needed).
Before all providers were using the helper.Schema approach the helper
function had these names. Now they all use names consistent with the Go
naming conventions except for these last few…
If a droplet's image slug is empty and its image id is empty, then the
image attribute should be empty, so we may assign from either. So it is
unnecessary to check if the image id is empty.
* remove unnecessary check for emptiness of image id
* reverse order of the conditions for assigning the image attribute,
with the default case (using the slug) first, and the fallback case
(using the id) second
Upstream in the digitalocean API, the size slug became a size
string, breaking pearkes/digitalocean.
https://github.com/pearkes/digitalocean/pull/1
This fixes compatibility for changes to that library.
closes#510