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

user_groups/list limited to length=100 #697

Open
mccasian opened this issue Dec 7, 2024 · 1 comment
Open

user_groups/list limited to length=100 #697

mccasian opened this issue Dec 7, 2024 · 1 comment

Comments

@mccasian
Copy link

mccasian commented Dec 7, 2024

Nutanix Cluster Information

Terraform Version

2024-12-07T18:57:55.329+0100 [INFO] Terraform version: 1.5.7
2024-12-07T18:57:55.330+0100 [DEBUG] using github.com/hashicorp/go-tfe v1.26.0
2024-12-07T18:57:55.330+0100 [DEBUG] using github.com/hashicorp/hcl/v2 v2.16.2
2024-12-07T18:57:55.330+0100 [DEBUG] using github.com/hashicorp/terraform-svchost v0.1.0
2024-12-07T18:57:55.330+0100 [DEBUG] using github.com/zclconf/go-cty v1.12.2
2024-12-07T18:57:55.330+0100 [INFO] Go runtime version: go1.23.1

Affected Resource(s)

nutanix_user_group

Terraform Configuration Files

locals {
  # read authorization_policies from the file
  cluster_admin_yaml = yamldecode(file("${path.module}/../../../../../../data/iam_config/cluster_admin.yaml"))
  
  # Convert the list to a set of strings
  cluster_admin_user_groups = toset([
    for user_group in local.cluster_admin_yaml.iam_entities.segment[var.segment].user_groups : user_group.name
  ])
}

data "nutanix_user_group" "user_groups_cluster_admin" {
  for_each = local.cluster_admin_user_groups
  user_group_distinguished_name = each.value # the name as written in the yaml file
}

Debug Output

---[ REQUEST ]---------------------------------------
POST /api/nutanix/v3/user_groups/list HTTP/1.1
Host: <censored_url>:9440
User-Agent: nutanix/v3
Content-Length: 47
Accept: application/json
Authorization: Basic cnVoMTo0RVgmeTQ0b0tZMi0hLTg=
Content-Type: application/json
Accept-Encoding: gzip

{
"filter": "",
"kind": "user_group",
"length": 100
}

As can be seen in the debug output, the length is 100 by default, which can prevent the user_group which is being searched for to be found, case when, the data source is not able to return the ID of the user_group although the user group exists and can be seen by calling the API manually with a higher "length".

Not to mention that, probably because the user_group is not found, it's later trying to look for "user" instead "user_groups" while calling the POST /api/nutanix/v3/user_groups/list HTTP/1.1. But for that, i'll create a dedicated issue.

Best regards
Casian

@mccasian
Copy link
Author

mccasian commented Dec 7, 2024

i've found the function responsible for returning the user_groups:

func (op Operations) ListUserGroup(getEntitiesRequest *DSMetadata) (*UserGroupListResponse, error) {

Unlike many other functions, It looks like this function doesn't have pagination implemented, that's why I see using TF_LOG=DEBUG that all API Requests sent by Terraform are having "offset": 0

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

1 participant