Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

provider/digitalocean: Support disk only resize #13059

Merged
merged 1 commit into from
Mar 27, 2017
Merged

provider/digitalocean: Support disk only resize #13059

merged 1 commit into from
Mar 27, 2017

Conversation

skovorodkin
Copy link
Contributor

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

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
```
@@ -144,6 +144,56 @@ func TestAccDigitalOceanDroplet_ResizeWithOutDisk(t *testing.T) {
})
}

func TestAccDigitalOceanDroplet_ResizeOnlyDisk(t *testing.T) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's possible to merge this test into TestAccDigitalOceanDroplet_ResizeWithOutDisk as it's the strict superset of the latter (and name it just TestAccDigitalOceanDroplet_Resize).


if err != nil {
// Wait for the resize action to complete.
if err := waitForAction(client, action); err != nil {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed WaitForDropletAttribute to waitForAction, because we don't know what disk size value to wait for, as it's not available from a resource configuration – all we've got is a size value, but it represents RAM size, not disk size.

So the only way is to wait for a resize action to complete.

@stack72
Copy link
Contributor

stack72 commented Mar 27, 2017

Hi @skovorodkin

This LGTM! The associated tests pass as expected as well :)

=== RUN   TestAccDigitalOceanDroplet_ResizeWithOutDisk
--- PASS: TestAccDigitalOceanDroplet_ResizeWithOutDisk (123.73s)
=== RUN   TestAccDigitalOceanDroplet_ResizeOnlyDisk
--- PASS: TestAccDigitalOceanDroplet_ResizeOnlyDisk (328.18s)

Thanks for the work here - I will look into the tests to see what can be merged

Paul

@stack72 stack72 merged commit 0ff734f into hashicorp:master Mar 27, 2017
@ghost
Copy link

ghost commented Apr 14, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DigitalOcean: resize droplet disk while preserving current CPU and RAM
3 participants