ovh / terraform-provider-ovh

Terraform OVH provider
https://registry.terraform.io/providers/ovh/ovh/latest/docs
Mozilla Public License 2.0
182 stars 133 forks source link

[BUG] ovh_dedicated_server_install_task fail on invalid partition schema (with no error) #671

Closed 131 closed 1 month ago

131 commented 2 months ago

Describe the bug

When providing ovh_dedicated_server_install_task with an invalid partition_scheme, terraform will timeout after 5+min.

module.docker-metal-ns3227476.ovh_dedicated_server_install_task.server_install: Still creating... [4m30s elapsed]
module.docker-metal-ns3227476.ovh_dedicated_server_install_task.server_install: Still creating... [4m40s elapsed]
module.docker-metal-ns3227476.ovh_dedicated_server_install_task.server_install: Still creating... [4m50s elapsed]
module.docker-metal-ns3227476.ovh_dedicated_server_install_task.server_install: Still creating... [5m0s elapsed]
module.docker-metal-ns3227476.ovh_dedicated_server_install_task.server_install: Still creating... [5m10s elapsed]
Error: Error waiting for Dedicated Server task ns3227476.ip-162-19-59.eu/0 to complete: OVHcloud API error (status code 404): "The requested object (taskId = 0) does not exist" (X-OVH-Query-Id: EU.ext-1.667c347e.1471990.838164703514e6b01e88e1a761d06a6b)

But using the SDK directly, i can receive an error immediately

Status : 404
Body : { message : "Partition scheme XX not found for template XXX"}

Having the error instantly instead of waiting for a timeout will help a lot.

Terraform Version

Terraform v1.8.4 on linux_amd64

Affected Resource(s)

Please list the resources as a list, for example:

Expected Behavior

Having the error instantly instead of waiting for a timeout will help a lot.

Actual Behavior

Timeout after a long time, to reinstall task started

amstuta commented 1 month ago

Hello @131 , you're right there is no need to wait for a task if there was an error returned at creation. I think we could check the taskId that is returned by the API and return immediately if it is equal to 0, we'll check this solution quickly.

131 commented 1 month ago

Thank you very much