cloudfoundry-community/terraform-provider-cloudfoundry

Error: Error when loading default quota in version 0.50.5

MatzeScandio opened this issue · 5 comments

We hid an error with the newest version 0.50.5

Error: Error when loading default quota: no resource exists with the name organization_quotas, did you add it to 'api/cloudcontroller/ccv3/internal/api_routes.go'? 

  on providers.tf line 63, in provider "cloudfoundry":
  63: provider "cloudfoundry" {}

When fixing the provider version to 0.50.4 the issue does not occur

 cloudfoundry = {
   source  = "cloudfoundry-community/cloudfoundry"
   version = "0.50.4"
 }

@Thanhphan1147 any ideas on this?

toabi commented

My feeling is it's maybe related to those lines?

v0.50.4...v0.50.5#diff-0699725891f824c351d041b354b8654923f9907cb8952349b63f00189c755762L419-R425

… as it changed from getQuoats to getOrganizationQuotas. Are Org Quotas a rather "newish" feature and our CF doesn't support them yet?

Hi @MatzeScandio, can you show me the output of cf curl /v3 targeting your CF environment? The issue here is that the list of available resources are fetched with a call to /v3. And I believe in earlier versions of the cloudcontroller this resources is not yet implemented (versions earlier than 3.80.0 : http://v3-apidocs.cloudfoundry.org/version/3.80.0/#organization-quotas)

Hi @Thanhphan1147 , thanks for looking at it. An outdated seems likely. Checked the api versions for our CF and it is 3.50.0 :

$ cf curl /v3 
{
   "links": {
      "self": {
         "href": "https://example.com/v3"
      },
      "apps": {
         "href": "https://example.com/v3/apps"
      },
      "audit_events": {
         "href": "https://example.com/v3/audit_events"
      },
      "buildpacks": {
         "href": "https://example.com/v3/buildpacks"
      },
      "builds": {
         "href": "https://example.com/v3/builds"
      },
      "deployments": {
         "href": "https://example.com/v3/deployments",
         "experimental": true
      },
      "domains": {
         "href": "https://example.com/v3/domains"
      },
      "droplets": {
         "href": "https://example.com/v3/droplets"
      },
      "environment_variable_groups": {
         "href": "https://example.com/v3/environment_variable_groups"
      },
      "feature_flags": {
         "href": "https://example.com/v3/feature_flags"
      },
      "isolation_segments": {
         "href": "https://example.com/v3/isolation_segments"
      },
      "organizations": {
         "href": "https://example.com/v3/organizations"
      },
      "packages": {
         "href": "https://example.com/v3/packages"
      },
      "processes": {
         "href": "https://example.com/v3/processes"
      },
      "resource_matches": {
         "href": "https://example.com/v3/resource_matches"
      },
      "roles": {
         "href": "https://example.com/v3/roles",
         "experimental": true
      },
      "routes": {
         "href": "https://example.com/v3/routes"
      },
      "service_brokers": {
         "href": "https://example.com/v3/service_brokers",
         "experimental": true
      },
      "service_instances": {
         "href": "https://example.com/v3/service_instances"
      },
      "service_offerings": {
         "href": "https://example.com/v3/service_offerings",
         "experimental": true
      },
      "spaces": {
         "href": "https://example.com/v3/spaces"
      },
      "stacks": {
         "href": "https://example.com/v3/stacks"
      },
      "tasks": {
         "href": "https://example.com/v3/tasks"
      },
      "users": {
         "href": "https://example.com/v3/users",
         "experimental": true
      }
   }
}

Any chance to make it backwards compatible, or would that be a big headache.

Hi, sorry for the late response,

It would probably be quite a headache since we'd need to add a logic to fetch quotas using /v2 endpoint if we don't find the /v3 endpoint. I think the best solution would simply be fixing your provider version until your org upgrades the CAPI version