civo / terraform-provider-civo

Terraform Civo provider
https://www.civo.com
Mozilla Public License 2.0
71 stars 56 forks source link

[BUG] Changing network on civo_instance resource should recreate instance #225

Closed fernando-villalba closed 3 months ago

fernando-villalba commented 3 months ago

Description

Currently, if you change the network id in an instance, nothing happens, it applies the change, and the next time it asks to apply the same change forever.

When you change the network on an instance, it should prompt to recreate that instance in a different network (ideally it would be nice if we could move the instance without deleting it, but this is the best we can do now)

Here is a code that can be used to reproduce the issue:

terraform {
  required_providers {
    civo = {
      source = "civo/civo"
      version = "1.0.44"

    }
  }
}

data "civo_network" "default" {
    label = "default"
    region = "LON1"
}

resource "civo_network" "test-issue" {
    label = "test-something"
}

resource "civo_instance" "foo" {
    hostname = "blaha"
    tags = ["python", "nginx"]
    notes = "He perepepppppepepe "
    size = "g3.xsmall"
    network_id = data.civo_network.default.id # start with this
    # network_id = civo_network.test-issue.id # Then change to this
    disk_image = "debian-10"
}

Screenshots

No response

Additional information

No response