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

Multiple cluster_role_selectors are ignored #1360

Closed
fmulero opened this issue Aug 10, 2021 · 4 comments · Fixed by #1697
Closed

Multiple cluster_role_selectors are ignored #1360

fmulero opened this issue Aug 10, 2021 · 4 comments · Fixed by #1697

Comments

@fmulero
Copy link

fmulero commented Aug 10, 2021

Terraform Version, Provider Version and Kubernetes Version

Terraform version: 1.0.0
Kubernetes provider version: 2.3.2
Kubernetes version: 1.18 (EKS)

Affected Resource(s)

resource "kubernetes_cluster_role" "example" {

  metadata {
    name   = "example"
  }

  aggregation_rule {
    cluster_role_selectors {
      match_labels = {
        "rbac.authorization.k8s.io/aggregate-to-view" = "true"
      }
    }
    cluster_role_selectors {
      match_labels = {
        "example.io/aggregregate-to-app" = "true"
      }
    }
  }
}

Expected Behavior

A role with the following aggregation rule is created:

aggregationRule:
  clusterRoleSelectors:
    - matchLabels:
        rbac.authorization.k8s.io/aggregate-to-view: 'true'
    - matchLabels:
        example.io/aggregregate-to-app: 'true'

Actual Behavior

The second cluster_role_selectors is ignored and only the first match_label rule is created (the same happens using match_expressions )

aggregationRule:
  clusterRoleSelectors:
    - matchLabels:
        rbac.authorization.k8s.io/aggregate-to-view: 'true'

References

@fmulero fmulero added the bug label Aug 10, 2021
@stevehipwell
Copy link
Contributor

We're seeing this same issue, how come nobody from @hashicorp has even commented on here yet?

@arybolovlev
Copy link
Contributor

Hi @fmulero,

Thank you for reporting this issue. It looks like we have missed for loop here.

@stevehipwell
Copy link
Contributor

@arybolovlev I'll open a PR to fix this, you can assign the issue to me.

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants