civo/terraform-provider-civo

[BUG] When creating a resource with Terraform that has already been created somewhere else it hangs...

Closed this issue · 1 comments

Description

If you create a resource in the Civo platform via the CLI for example, and then you try to create a resource with the same name in Terraform, the expected behaviour should be that it fails immediately with an error message saying something like:

"Resource X already exists, please go to dashboard https://dashboard.civo.com/ and check or pick a different name for resource"

Instead terraform just hangs until timeout is reached in 2 minutes, wasting a lot of the user's time.

Do this first:

civo network create test-crazy 

And then apply this:

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

Result:

civo_network.test-issue: Creating...
civo_instance.foo: Creating...
civo_network.test-issue: Creation complete after 0s [id=14ba5453-c246-4446-b93e-5c3c90af387e]
civo_instance.foo: Still creating... [10s elapsed]
civo_instance.foo: Still creating... [20s elapsed]
civo_instance.foo: Still creating... [30s elapsed]
civo_instance.foo: Still creating... [40s elapsed]
civo_instance.foo: Still creating... [50s elapsed]
civo_instance.foo: Still creating... [1m0s elapsed]
civo_instance.foo: Still creating... [1m10s elapsed]
civo_instance.foo: Still creating... [1m20s elapsed]
civo_instance.foo: Still creating... [1m30s elapsed]
civo_instance.foo: Still creating... [1m40s elapsed]
civo_instance.foo: Still creating... [1m50s elapsed]
civo_instance.foo: Still creating... [2m0s elapsed]
╷
│ Error: [ERR] failed to create instance after multiple attempts: timeout reached
│ 
│   with civo_instance.foo,
│   on vm_instance.tf line 111, in resource "civo_instance" "foo":
│  111: resource "civo_instance" "foo" {

Acceptance Criteria

  • Fix this for instances and network. Instead of timing out, fail quickly with an error message similar to "Resource X already exists, please go to dashboard https://dashboard.civo.com/ and check or pick a different name for resource"
  • Check other resources and see if the same happens and fix that too

Screenshots

No response

Additional information

No response

Hi @uzaxirr,

I hope you're doing well.

I am willing to work on this issue. Could you please assign it to me if that's okay?

Thank you!