There are three "deeper" changes included with this update:
1) The `Detach` function got removed from the `StorageActionsService` in
favor of `DetachByDropletID` (which is now used in
`resource_digitalocean_volume.go`).
2) The `Update` function got removed from `TagsService` (renaming a tag
has been deprecated in the API).
3) Every function in godo now takes a `context.Context` as first
argument, so I've changed all calls to send in a `context.Background()`.
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>
Reverts #13883.
Quoting @radeksimko: "We actually refresh the state
as part of every test step, so this is not necessary"
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.
The second step of the `TestAccDigitalOceanDroplet_ResizeWithOutDisk` acceptance test was regularly failing. Upon investigation it was found that the second step's Terraform configuration had omitted the `user_data` parameter, thus forcing Terraform to create a new droplet resource instead of updating the current resource.
```
-/+ digitalocean_droplet.foobar
disk: "20" => "<computed>"
image: "centos-7-x64" => "centos-7-x64"
ipv4_address: "138.197.0.55" => "<computed>"
ipv4_address_private: "" => "<computed>"
ipv6_address: "" => "<computed>"
ipv6_address_private: "" => "<computed>"
locked: "false" => "<computed>"
name: "foo" => "foo"
region: "nyc3" => "nyc3"
resize_disk: "true" => "false"
size: "512mb" => "1gb"
ssh_keys.#: "1" => "1"
ssh_keys.0: "5770472" => "5770472"
status: "active" => "<computed>"
user_data: "foobar" => "" (forces new resource)
vcpus: "1" => "<computed>"
```
This fixes the acceptance test by adding the missing `user_data` parameter.
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
* Add SSH Keys to all droplets in tests, this prevents acctests from
spamming account owner email with root password details
* Add a new helper/acctest package to be a home for random string / int
implementations used in tests.
* Insert some random details into record tests to prevent collisions
* Normalize config style in tests to hclfmt conventions
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