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] Error creating OpenStack compute client: No suitable endpoint could be found in the service catalog. when creating sshkey in OVH-US region #832

Open
jtrebaol opened this issue Feb 7, 2025 · 1 comment

Comments

@jtrebaol
Copy link

jtrebaol commented Feb 7, 2025

Describe the bug

We want to create through Terraform openstack_compute_keypair_v2 resources in OVH-US regions US-WEST-OR-1 and US-EAST-VA-1

Terraform Version

OpenTofu v1.8.5
on linux_amd64

  • provider registry.opentofu.org/hashicorp/null v3.2.3
  • provider registry.opentofu.org/hashicorp/openstack v3.0.0
  • provider registry.opentofu.org/hashicorp/ovh v1.6.0
  • provider registry.opentofu.org/hashicorp/random v3.6.3
  • provider registry.opentofu.org/hashicorp/template v2.2.0
  • provider registry.opentofu.org/ovh/ovh v1.6.0
  • provider registry.opentofu.org/terraform-provider-openstack/openstack v3.0.0

OVH Terraform Provider Version

  • provider registry.opentofu.org/hashicorp/ovh v1.6.0

Affected Resource(s)

Please list the resources as a list, for example:

  • openstack_compute_keypair_v2
  • openstack_compute_instance_v2

Terraform Configuration Files

Root module:

providers.tf
terraform {
required_version    = ">= 0.14.0"
  required_providers {
    openstack = {
      source  = "terraform-provider-openstack/openstack"
      version = "~> 3.0.0"
    }

    ovh = {
      source  = "ovh/ovh"
      version = ">= 0.13.0"
    }
  }
}

provider "openstack" {
  auth_url    = "https://auth.cloud.ovh.net/v3/"   
  domain_name = "default"                         
  alias       = "ovh"                               
}

provider "ovh" {
  alias              = "ovh"
  endpoint           = "ovh-eu"
}

provider "ovh" {
  alias              = "ovh-us"
  endpoint           = "ovh-us"
  application_key    = "zzz"
  application_secret = "yyy"
  consumer_key       = "xxx"
}

variables.tf
region_ovh_us = ["US-EAST-VA-1","US-WEST-OR-1"]

main.tf

module "ovh_keypair3" {
  source                 = "../../modules/ovh_keypair"
  region_ovh             = var.region_ovh_us
  ovh_endpoint           = "ovh-us"
  key_name               = "terraform_ovh"
  TERRAFORM_PROJECT_PATH = var.TERRAFORM_PROJECT_PATH
  providers = {
    openstack          = openstack.ovh
  }
}
Child module modules/ovh_keypair:
providers.tf
terraform {
required_version    = ">= 0.14.0"
  required_providers {
    openstack = {
      source  = "terraform-provider-openstack/openstack"
      version = "~> 3.0.0"
    }

    ovh = {
      source  = "ovh/ovh"
      version = ">= 0.15.0"
    }
  }
}

keypair.tf
resource "openstack_compute_keypair_v2" "keypair" {
  for_each   = toset(var.region_ovh)   # We create the number of instances corresponding to number of regions
  provider   = openstack             # OVH Cloud provider declared in provider.tf
  name       = "${var.key_name}"    # SSH Key Name
  public_key = file("${var.TERRAFORM_PROJECT_PATH}/terraform/files/ssh/terraform_ovh.pub") # Path to SSH Key (.pub)
  region     = each.value
  lifecycle {
    prevent_destroy = true
   }
}

Debug Output

` module.ovh_keypair3.openstack_compute_keypair_v2.keypair["US-EAST-VA-1"] will be created

  • resource "openstack_compute_keypair_v2" "keypair" {
    • fingerprint = (known after apply)
    • id = (known after apply)
    • name = "terraform_ovh"
    • private_key = (sensitive value)
    • public_key = <<-EOT
      ssh-rsa xxx
      EOT
    • region = "US-EAST-VA-1"
    • user_id = (known after apply)
      }

module.ovh_keypair3.openstack_compute_keypair_v2.keypair["US-WEST-OR-1"] will be created

  • resource "openstack_compute_keypair_v2" "keypair" {
    • fingerprint = (known after apply)
    • id = (known after apply)
    • name = "terraform_ovh"
    • private_key = (sensitive value)
    • public_key = <<-EOT
      ssh-rsa xxx
      EOT
    • region = "US-WEST-OR-1"
    • user_id = (known after apply)
      }

2025-02-07T10:39:14.907+0100 [INFO] provider.terraform-provider-openstack_v3.0.0: 2025/02/07 10:39:14 [DEBUG] OpenStack Region is: US-EAST-VA-1: timestamp="2025-02-07T10:39:14.907+0100"
2025-02-07T10:39:14.907+0100 [INFO] provider.terraform-provider-openstack_v3.0.0: 2025/02/07 10:39:14 [DEBUG] Locked "auth": timestamp="2025-02-07T10:39:14.907+0100"
2025-02-07T10:39:14.907+0100 [INFO] provider.terraform-provider-openstack_v3.0.0: 2025/02/07 10:39:14 [DEBUG] Unlocking "auth": timestamp="2025-02-07T10:39:14.907+0100"
2025-02-07T10:39:14.907+0100 [INFO] provider.terraform-provider-openstack_v3.0.0: 2025/02/07 10:39:14 [DEBUG] Unlocked "auth": timestamp="2025-02-07T10:39:14.907+0100"
2025-02-07T10:39:14.907+0100 [INFO] provider.terraform-provider-openstack_v3.0.0: 2025/02/07 10:39:14 [DEBUG] OpenStack Region is: US-WEST-OR-1: timestamp="2025-02-07T10:39:14.907+0100"
2025-02-07T10:39:14.907+0100 [ERROR] provider.terraform-provider-openstack_v3.0.0: Response contains error diagnostic: tf_proto_version=5.4 tf_provider_addr=registry.terraform.io/terraform-provider-openstack/openstack diagnostic_severity=ERROR diagnostic_summary="Error creating OpenStack compute client: No suitable endpoint could be found in the service catalog." tf_req_id=bad17999-eff3-00e1-909f-70766b45d0a4 tf_resource_type=openstack_compute_keypair_v2 @module=sdk.proto diagnostic_detail="" tf_rpc=ApplyResourceChange @caller=github.com/hashicorp/terraform-plugin-go@v0.19.0/tfprotov5/internal/diag/diagnostics.go:58 timestamp="2025-02-07T10:39:14.907+0100"
2025-02-07T10:39:14.907+0100 [ERROR] provider.terraform-provider-openstack_v3.0.0: Response contains error diagnostic: tf_provider_addr=registry.terraform.io/terraform-provider-openstack/openstack tf_req_id=3f04789c-a33c-592b-876d-14a7dec45546 tf_proto_version=5.4 @caller=github.com/hashicorp/terraform-plugin-go@v0.19.0/tfprotov5/internal/diag/diagnostics.go:58 diagnostic_severity=ERROR diagnostic_summary="Error creating OpenStack compute client: No suitable endpoint could be found in the service catalog." @module=sdk.proto diagnostic_detail="" tf_rpc=ApplyResourceChange tf_resource_type=openstack_compute_keypair_v2 timestamp="2025-02-07T10:39:14.907+0100"
2025-02-07T10:39:14.909+0100 [DEBUG] State storage *remote.State declined to persist a state snapshot
2025-02-07T10:39:14.909+0100 [ERROR] vertex "module.ovh_keypair3.openstack_compute_keypair_v2.keypair["US-WEST-OR-1"]" error: Error creating OpenStack compute client: No suitable endpoint could be found in the service catalog.
2025-02-07T10:39:14.910+0100 [DEBUG] State storage *remote.State declined to persist a state snapshot
2025-02-07T10:39:14.910+0100 [ERROR] vertex "module.ovh_keypair3.openstack_compute_keypair_v2.keypair["US-EAST-VA-1"]" error: Error creating OpenStack compute client: No suitable endpoint could be found in the service catalog.`

Expected Behavior

openstack resources shall be created in OVH-US regions

Actual Behavior

Regions are not found into the catalog

Steps to Reproduce

  1. terraform apply

Additional context

Assumptions: When declaring the openstack provider, auth_url is https://auth.cloud.ovh.net/v3/ and might not match with OVH-US or when calling child module, the provider passed in argument does not fit with expected openstack endpoint

@amstuta
Copy link
Contributor

amstuta commented Feb 7, 2025

Hello @jtrebaol, I think your auth_url is not the right one for the US region, you should use https://auth.cloud.ovh.us/v3 (if you want, you can directly download a file openrc.sh with all these information from a public cloud project on OVHcloud website, in section Users & roles).

Also, you may have to declare the region field in your Openstack provider or add the env variable export OS_REGION_NAME="US-EAST-VA" (and probably declare several providers, one per region).

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

No branches or pull requests

2 participants