When we keep invoking terraform apply multiple times, Terraform may report changes in the rancher2_registry resource when we do not change anything.
Please check the linked GH issue for detailed examples.
It happens because when terraform-provider-rancher2 flattens the registry credential, it needs to convert a Map into a List, Golang does not guarantee the order of returned objects when traversing a Map, and terraform-provider-rancher2 saves items in the order of receiving, so the order of items in the final List may change even though it is the same set of items. Therefore, Terraform detects and reports changes.
Solution
Preserve the order of existing items in the final List can prevent Terraform from reporting such changes
Testing
Engineering Testing
Manual Testing
This fix is tested locally by adding extra logging lines which show that the order of existing items is preserved.
Issue:
https://github.com/rancher/terraform-provider-rancher2/issues/923
Problem
When we keep invoking
terraform apply
multiple times, Terraform may report changes in therancher2_registry
resource when we do not change anything.Please check the linked GH issue for detailed examples.
It happens because when terraform-provider-rancher2 flattens the registry credential, it needs to convert a Map into a List, Golang does not guarantee the order of returned objects when traversing a Map, and terraform-provider-rancher2 saves items in the order of receiving, so the order of items in the final List may change even though it is the same set of items. Therefore, Terraform detects and reports changes.
Solution
Preserve the order of existing items in the final List can prevent Terraform from reporting such changes
Testing
Engineering Testing
Manual Testing
This fix is tested locally by adding extra logging lines which show that the order of existing items is preserved.
Automated Testing
The existing test case is updated.
QA Testing Considerations
the same case as the GH issue provides.
Regressions Considerations
none