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

fix: wrong result of data rancher2_principal #1335

Open wgjak47 opened 3 months ago

wgjak47 commented 3 months ago

Issue: https://github.com/rancher/terraform-provider-rancher2/issues/1330

Problem

When using the data source rancher2_principal to search for a principal, it may return wrong result when one principal name is the prefix of another principal, for example: k8s-admin, k8s-admin-test

Solution

In this code , check the return result is really match the request name.

Testing

As the issue describe. ## Engineering Testing ### Manual Testing

Now the data source rancher2_principal will always return k8s-admin when you set the name as k8s-admin, instead of return k8s-admin-test.

Automated Testing

QA Testing Considerations

Regressions Considerations