-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Description
I noticed that during an in-place update of the subjects in a kubernetes_cluster_role_binding resource the resulting applied changes were incorrect. This seems to be happening when the update changes the number of subjects and the order they are added. The plan looks correct but when applied the resulting subjects in the Kubernetes resource are incorrect.
This is a pretty critical error as it could give the user a false sense of assurance that the correct access rules are in place while they are in fact not.
Terraform Version
Terraform v0.12.17
- provider.kubernetes v1.10.0
Affected Resource(s)
- kubernetes_cluster_role_binding
- kubernetes_role_binding (probably, not tested)
Terraform Configuration Files
resource "kubernetes_cluster_role_binding" "cluster_admin" {
metadata {
name = "custom-cluster-admin"
}
role_ref {
api_group = "rbac.authorization.k8s.io"
kind = "ClusterRole"
name = "cluster-admin"
}
dynamic "subject" {
for_each = local.rbac_cluster_admin_users
content {
kind = "User"
name = subject.value
api_group = "rbac.authorization.k8s.io"
}
}
dynamic "subject" {
for_each = local.rbac_cluster_admin_groups
content {
kind = "Group"
name = subject.value
api_group = "rbac.authorization.k8s.io"
}
}
}Expected Behavior
The correct subjects in the ClusterRoleBinding k8s resource.
Actual Behavior
Incorrect subjects in the ClusterRoleBinding k8s resource.
Steps to Reproduce
- Update the kubernetes_cluster_role_binding resource subject configuration.
terraform applyterraform applyagain
See the failing test case I commited here for a specific example: #712
pdecat
Metadata
Metadata
Assignees
Labels
No labels