rancher / terraform-provider-rancher2

Terraform Rancher2 provider
https://www.terraform.io/docs/providers/rancher2/
Mozilla Public License 2.0
253 stars 216 forks source link

[BUG] Can't move namespace when resource quota set #1328

Open radhika-pr opened 3 months ago

radhika-pr commented 3 months ago

Rancher Server Setup

Information about the Cluster

User Information

Provider Information

Describe the bug

Cannot move a rancher namespace from on project to another when resource quota is set.


Terraform will perform the following actions:
  # rancher2_namespace.XXnamespace will be updated in-place
  ~ resource "rancher2_namespace" "XXnamespace" {
        id               = "XXnamespace"
        name             = "XXnamespace"
      ~ project_id       = "c-6s75g:p-ZZZ" -> "c-6s75g:p-XXX"
        # (4 unchanged attributes hidden)
        # (1 unchanged block hidden)
    }
Plan: 0 to add, 1 to change, 0 to destroy.
rancher2_namespace.XXnamespace: Modifying... [id=XXnamespace]
╷
│ Error: Bad response statusCode [500]. Status [500 Internal Server Error]. Body: [baseType=error, code=ServerError, message=can't move namespace. Project team-build-eng-develocity-prod has resource quota set] from [https://rancher.services.k8sop.relexsolutions.com/v3/cluster/c-6s75g/namespaces/XXnamespace?action=move]
│ 
│   with rancher2_namespace.XXnamespace,
│   on rancher.tf line 51, in resource "rancher2_namespace" "XXnamespace":
│   51: resource "rancher2_namespace" "XXnamespace" {

### To Reproduce
1. Create a namespace under a Rancher project which has resource quota set. 
2. Create another project with resource quotas 
3. Move the namespace created in step1 to new project which was created in step2 (use terraform in all steps)

### Actual Result
500 error is thrown. 
"Project team-build-eng-develocity-prod has resource quota set] from [https://rancher.services.k8sop.relexsolutions.com/v3/cluster/c-6s75g/namespaces/XXnamespace?action=move]"

### Expected Result
Namespace moved to new project
matttrach commented 5 days ago

This appears to be a limitation in Rancher rather than the provider, would you be able to try the same action in the GUI? Please try running in debug mode so that you can capture the API requests and responses, this will help us troubleshoot further.

radhupr commented 3 days ago

@matttrach The namespace was moved from the UI without any error. The error was seen while using the terraform code.