Skip to content

[BUG] cloudfoundry_org_quota: Cannot switch org from one quota to another in a single apply #314

@gaetan-tltvl

Description

@gaetan-tltvl

Is there an existing issue for this?

  • I have searched the existing issues

What version of the Terraform provider are you using?

1.8.0

What version of the Terraform CLI are you using?

1.13.0

What CF API version are you using?

3.200.0

What type of issue are you facing

bug report

Describe the bug

Describe the bug

switch org from quota

  1. When switching an organization from quota A to quota B using the cloudfoundry_org_quota resource, Terraform fails with but in api side the org is well assigned to the new quota:

│ Error: Unable to update org quota

│ with module.multisite.cloudfoundry_org_quota.test-quota,
│ on ../multisite/service-archi-me1-staging.tf line 25, in resource "cloudfoundry_org_quota" "test-quota":
│ 25: resource "cloudfoundry_org_quota" "test-quota" {

│ Cannot unassign org quota from org [24ff2436-153a-4792-9d2b-13e84ef3d7df]

Simply remove org from org_quota

  1. When I try to remove an org from a quota by itself, it doesn’t work at all — I cannot unassign the org from the quota, even if I restart a terraform apply behind.

Simply remove the cloudfoudry_org_quota

  1. When i delete cloudfoundry_org_quota entirely i have the same problem than before, impossibility to remove the resource with a terraform apply.

Additional context
This seems to be a limitation in the cloudfoundry_org_quota resource. The resource currently separates the update into DELETE then ADD, which is rejected by the CF API.

It would be helpful if the provider could handle direct org quota switching or provide guidance in documentation.

Expected Behavior

Terraform should either:

switch org from quota

  • Successfully switch the org from quota A to quota B in one apply, or
  • Provide a clear workflow to handle the quota reassignment

Simply remove org from org_quota

it should be accepted if i want to remove an org from cloudfoundry_org_quotas.

Simply remove the cloudfoudry_org_quota

it should be accepted if i want to simply remove cloudfoundry_org_quota resource.

Steps To Reproduce

switch org from quota

  1. Create an org assigned to quota A
  2. Update Terraform .tf to assign the same org to quota B and unassign org from quota A
  3. Run terraform apply
  4. Observe the error above
  5. if you launch terraform apply once again it works

Simply remove org from org_quota

1.Add an org to cloudfoundry_org_quota
2. Terraform apply
3. Remove an org from cloudfoundry_org_quota
4. Terraform apply twice

Simply remove the cloudfoudry_org_quota

  1. Add an cloudfoundry_org_quota
  2. add an org to cloudfoundry_org_quota
  3. terraform apply
  4. Remove the cloudfoundry_org_quota entirely
  5. Terraform apply twice

Your Terraform Configuration

terraform {
  required_providers {
    cfsecurity = {
      source  = "orange-cloudfoundry/cfsecurity"
      version = "~>0.117.0"
    }
    cloudfoundry = {
      source = "cloudfoundry/cloudfoundry"
      version = "1.8.0"
    }
  }
  required_version = ">= 1.13.0"
}

Roles

  • Org Manager
  • ADMIN

Add screenshots to help explain your problem

Image

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcontribution requiredA Community Contribution is required

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions