Skip to content

Be more intelligent about adding local storage #198

@mbunkus

Description

@mbunkus

Summary

If we have an existing, running server & want to add a new Rocket Storage (storage_variant = "local"), we have to turn the server off manually before the changes can be applied. If the server is still running, a 409 error is returned by the API ('Hot-Plug of local storages is not supported.').

Terraform Version

Terraform v1.1.7
on linux_amd64
+ provider registry.terraform.io/gridscale/gridscale v1.14.2
+ provider registry.terraform.io/hashicorp/dns v3.2.3

Affected Resource(s)

  • gridscale_server & gridscale_storage

Terraform Configuration Files

resource "gridscale_storage" "test_mein_dc-primary-root" {
  name     = "test_mein_dc-primary root"
  capacity = 50
}

# resource "gridscale_storage" "test_mein_dc-primary-root_rocket" {
#   name            = "test_mein_dc-primary root rocket"
#   capacity        = 50
#   storage_variant = "local"
# }

resource "gridscale_server" "test_mein_dc-primary" {
  name             = "test_mein_dc-primary"
  cores            = 2
  memory           = 4
  hardware_profile = "q35"
  power            = true
  storage {
    object_uuid = gridscale_storage.test_mein_dc-primary-root.id
  }
  # storage {
  #   object_uuid = gridscale_storage.test_mein_dc-primary-root_rocket.id
  # }
}

Debug Output

Debug output

Expected Behavior

The server should be turned off, the storage should be added & the server should be turned on again, as is done for other similar types of changes.

Actual Behavior

The API returns the following error & the changes aren't applied:

gridscale_server.test_mein_dc-primary: Modifying... [id=d98293fe-583e-4c82-9061-b140cfac7cbb]
╷
│ Error: update server (d98293fe-583e-4c82-9061-b140cfac7cbb) resource - error: Error waiting for storage (a5c5c81f-e5c7-411a-a708-4d98905670a4) to be attached to server (d98293fe-583e-4c82-9061-b140cfac7cbb): Status code: 409. Error: {'type': 'HTTPError', 'status_code': 409, 'message': "(409, 'Hot-Plug of local storages is not supported.')"}. Request UUID: 1e035db3-f76c-42b7-9ed1-430ce9de0469.
│
│   with gridscale_server.test_mein_dc-primary,
│   on 33_env_test_mein.tf line 74, in resource "gridscale_server" "test_mein_dc-primary":
│   74: resource "gridscale_server" "test_mein_dc-primary" {

Steps to Reproduce

  1. terraform apply the config above first with the commented-out sections as they are to create a running server
  2. Comment-in the two storage sections & try terraform apply again. You'll run into the error now.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions