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] Impossible to use terraform to configure a compute instance - No suitable endpoint could be found in the service catalog #670

Closed vparpoil closed 2 months ago

vparpoil commented 2 months ago

Describe the bug

Here is the output of terraform apply with debug mode

│ Error: Error creating OpenStack compute client: No suitable endpoint could be found in the service catalog.
│ 
│   with openstack_compute_instance_v2.test_terraform_instance,
│   on main.tf line 9, in resource "openstack_compute_instance_v2" "test_terraform_instance":
│    9: resource "openstack_compute_instance_v2" "test_terraform_instance" {
│ 
full output bellow ``` 2024-06-26T17:28:51.998+0200 [INFO] provider.terraform-provider-openstack_v2.0.0: 2024/06/26 17:28:51 [DEBUG] Unlocking "auth": timestamp="2024-06-26T17:28:51.998+0200" 2024-06-26T17:28:51.998+0200 [INFO] provider.terraform-provider-openstack_v2.0.0: 2024/06/26 17:28:51 [DEBUG] Unlocked "auth": timestamp="2024-06-26T17:28:51.998+0200" 2024-06-26T17:28:51.998+0200 [INFO] provider.terraform-provider-openstack_v2.0.0: 2024/06/26 17:28:51 [DEBUG] OpenStack Region is: SBG7: timestamp="2024-06-26T17:28:51.998+0200" 2024-06-26T17:28:51.998+0200 [TRACE] provider.terraform-provider-openstack_v2.0.0: Called downstream: tf_req_id=dd8de72f-16a1-ac44-463f-0979c1722624 @module=sdk.helper_schema tf_provider_addr=registry.terraform.io/terraform-provider-openstack/openstack tf_resource_type=openstack_compute_instance_v2 tf_rpc=ApplyResourceChange @caller=github.com/hashicorp/terraform-plugin-sdk/v2@v2.30.0/helper/schema/resource.go:910 timestamp="2024-06-26T17:28:51.998+0200" 2024-06-26T17:28:51.998+0200 [TRACE] provider.terraform-provider-openstack_v2.0.0: Received downstream response: diagnostic_error_count=1 tf_req_duration_ms=175 tf_provider_addr=registry.terraform.io/terraform-provider-openstack/openstack tf_resource_type=openstack_compute_instance_v2 @module=sdk.proto diagnostic_warning_count=0 tf_proto_version=5.4 tf_rpc=ApplyResourceChange @caller=github.com/hashicorp/terraform-plugin-go@v0.19.0/tfprotov5/internal/tf5serverlogging/downstream_request.go:40 tf_req_id=dd8de72f-16a1-ac44-463f-0979c1722624 timestamp="2024-06-26T17:28:51.998+0200" 2024-06-26T17:28:51.998+0200 [ERROR] provider.terraform-provider-openstack_v2.0.0: Response contains error diagnostic: @caller=github.com/hashicorp/terraform-plugin-go@v0.19.0/tfprotov5/internal/diag/diagnostics.go:58 tf_req_id=dd8de72f-16a1-ac44-463f-0979c1722624 @module=sdk.proto diagnostic_summary="Error creating OpenStack compute client: No suitable endpoint could be found in the service catalog." tf_proto_version=5.4 tf_resource_type=openstack_compute_instance_v2 tf_rpc=ApplyResourceChange diagnostic_detail="" tf_provider_addr=registry.terraform.io/terraform-provider-openstack/openstack diagnostic_severity=ERROR timestamp="2024-06-26T17:28:51.998+0200" 2024-06-26T17:28:51.998+0200 [TRACE] provider.terraform-provider-openstack_v2.0.0: Served request: @module=sdk.proto tf_provider_addr=registry.terraform.io/terraform-provider-openstack/openstack tf_req_id=dd8de72f-16a1-ac44-463f-0979c1722624 tf_rpc=ApplyResourceChange @caller=github.com/hashicorp/terraform-plugin-go@v0.19.0/tfprotov5/tf5server/server.go:872 tf_proto_version=5.4 tf_resource_type=openstack_compute_instance_v2 timestamp="2024-06-26T17:28:51.998+0200" 2024-06-26T17:28:51.998+0200 [TRACE] maybeTainted: openstack_compute_instance_v2.test_terraform_instance encountered an error during creation, so it is now marked as tainted 2024-06-26T17:28:51.998+0200 [TRACE] terraform.contextPlugins: Schema for provider "registry.terraform.io/terraform-provider-openstack/openstack" is in the global cache 2024-06-26T17:28:51.998+0200 [TRACE] NodeAbstractResouceInstance.writeResourceInstanceState to workingState for openstack_compute_instance_v2.test_terraform_instance 2024-06-26T17:28:51.998+0200 [TRACE] NodeAbstractResouceInstance.writeResourceInstanceState: removing state object for openstack_compute_instance_v2.test_terraform_instance 2024-06-26T17:28:51.998+0200 [TRACE] evalApplyProvisioners: openstack_compute_instance_v2.test_terraform_instance is tainted, so skipping provisioning 2024-06-26T17:28:51.998+0200 [TRACE] maybeTainted: openstack_compute_instance_v2.test_terraform_instance was already tainted, so nothing to do 2024-06-26T17:28:51.998+0200 [TRACE] terraform.contextPlugins: Schema for provider "registry.terraform.io/terraform-provider-openstack/openstack" is in the global cache 2024-06-26T17:28:51.998+0200 [TRACE] NodeAbstractResouceInstance.writeResourceInstanceState to workingState for openstack_compute_instance_v2.test_terraform_instance 2024-06-26T17:28:51.998+0200 [TRACE] NodeAbstractResouceInstance.writeResourceInstanceState: removing state object for openstack_compute_instance_v2.test_terraform_instance 2024-06-26T17:28:51.998+0200 [DEBUG] State storage *remote.State declined to persist a state snapshot 2024-06-26T17:28:51.998+0200 [ERROR] vertex "openstack_compute_instance_v2.test_terraform_instance" error: Error creating OpenStack compute client: No suitable endpoint could be found in the service catalog. 2024-06-26T17:28:51.998+0200 [TRACE] vertex "openstack_compute_instance_v2.test_terraform_instance": visit complete, with errors 2024-06-26T17:28:51.998+0200 [TRACE] dag/walk: upstream of "provider[\"registry.terraform.io/terraform-provider-openstack/openstack\"].ovh (close)" errored, so skipping 2024-06-26T17:28:51.998+0200 [TRACE] dag/walk: upstream of "root" errored, so skipping 2024-06-26T17:28:51.998+0200 [DEBUG] states/remote: state read serial is: 16; serial is: 16 2024-06-26T17:28:51.998+0200 [DEBUG] states/remote: state read lineage is: 8e91f79d-0d24-cc7f-c3f4-18d948848f4a; lineage is: 8e91f79d-0d24-cc7f-c3f4-18d948848f4a ╷ │ Error: Error creating OpenStack compute client: No suitable endpoint could be found in the service catalog. │ │ with openstack_compute_instance_v2.test_terraform_instance, │ on main.tf line 9, in resource "openstack_compute_instance_v2" "test_terraform_instance": │ 9: resource "openstack_compute_instance_v2" "test_terraform_instance" { │ ╵ 2024-06-26T17:28:52.394+0200 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF" 2024-06-26T17:28:52.397+0200 [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/terraform-provider-openstack/openstack/2.0.0/darwin_arm64/terraform-provider-openstack_v2.0.0 pid=74149 2024-06-26T17:28:52.397+0200 [DEBUG] provider: plugin exited ```

Terraform Version

Terraform v1.7.1
on darwin_arm64
+ provider registry.terraform.io/hashicorp/aws v4.67.0
+ provider registry.terraform.io/hashicorp/google v5.35.0
+ provider registry.terraform.io/ovh/ovh v0.45.0
+ provider registry.terraform.io/terraform-provider-openstack/openstack v2.0.0

Affected Resource(s)

Terraform Configuration Files

This is directly used from the docs

resource "openstack_compute_instance_v2" "test_terraform_instance" {
  name        = "terraform_instance"    # Nom de l'instance
  provider    = openstack.ovh           # Nom du fournisseur
  image_name  = "Debian 10"             # Nom de l'image
  flavor_name = "s1-2"                  # Nom du type d'instance
  # Nom de la ressource openstack_compute_keypair_v2 nommée test_keypair
  key_pair    = openstack_compute_keypair_v2.my_sskkey.name
  network {
    name = "Ext-Net" # Ajoute le composant réseau pour atteindre votre instance
  }
  lifecycle {
    # OVHcloud met régulièrement à jour l’image de base d’un OS donné afin que le client ait moins de paquets à mettre à jour après le lancement d’une nouvelle instance
    # Pour éviter que terraform ne rencontre des problèmes avec cela, la commande ignore_changes suivante est requise.
    ignore_changes = [
      image_name
    ]
  }
}

Any hint on how to solve this ? Thanks

vparpoil commented 2 months ago

Found the issue while trying to create the instances manually, I had to activate the region SBG7 in my project quotas... The error message could be more precise to avoid hours of trial & error

rbeuque74 commented 2 months ago

Hello @vparpoil ,

Thanks for your issue. Regarding the fact the error is not clear enough, the resource you are using is not part of the terraform-provider-ovh, but in the terraform-provider-openstack. I suggest that you open the issue on their side if they are willing to improve the readability of this error message.

I will close this for the moment, but feel free to re-open if needed. Romain