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

[Bug]: Terraform loses sight of compute instance if you create it too small for block storage #375

Open
jamielinux opened this issue Jul 16, 2024 · 2 comments
Labels

Comments

@jamielinux
Copy link

Current Behavior

Let's say your config looks something like this:

resource "exoscale_block_storage_volume" "disk-01" {
  zone = local.zone
  name = "disk-01"
  size = 10
  lifecycle {
    prevent_destroy = true
  }
}

data "exoscale_template" "my_template" {
  zone = "ch-gva-2"
  name = "Linux Ubuntu 22.04 LTS 64-bit"
}

resource "exoscale_compute_instance" "my_instance" {
  zone                     = "ch-gva-2"
  name                     = "my-instance"
  template_id              = data.exoscale_template.my_template.id
  type                     = "standard.tiny"
  disk_size                = 10
  block_storage_volume_ids = [exoscale_block_storage_volume.disk-01.id]
}

When I run tofu apply I get:

Error: unable to parse attached instance ID: AttachBlockStorageVolumeToInstance: http response: invalid request: Request restricted: Instance size must be at least small

Running tofu state list, it lists the block storage but not the compute instance. But the compute instance actually exists and is running. This compute instance cannot be destroyed by Terraform, because Terraform doesn't know it exists (unless you manually import it, but I didn't try that).

Expected Behavior

If the VM is created, Terraform should have it in its state. Alternatively, I guess VM creation could be halted and the VM destroyed as part of the failure. In either case, Terraform state should match what actually happened.

Thank you!

Steps To Reproduce

No response

Provider Version

0.59.1

Terraform Version

OpenTofu v1.7.3

Relevant log output

No response

@jamielinux jamielinux added the bug label Jul 16, 2024
@kobajagi
Copy link
Contributor

Thanks for report. I can reproduce the issue., we will look into improving error handling.

@sauterp
Copy link
Member

sauterp commented Jul 23, 2024

We plan to migrate this resource to the new terraform framework and fix this at the same time. It's not a priority at the moment but it is planned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants