We use Terraform, and in particular the Rancher Terraform Provider to automate the creation of environments, registry and stacks. Terraform uses a declaration of desired state to converge from what exists by comparing actual versus required. In the case of a stack, Terraform compares the docker-compose that Rancher has to the corresponding content provided to Terraform by calling the Rancher API. However, we have noted that the docker-compose in Rancher is not always quite the same as the one we may have used when creating the stack and specifically environment variables are re-ordered (looks like alphabetically taking account of case). Whilst functionally (in this case anyway) reordering has no adverse impact, it means that unless we ensure that convention is also applied to the docker-compose we give to Terraform it will be detected as a difference and potentially that stack will be upgraded when there is no need to do so (Terraform honours idempotence so no change = no-op which is definitely what you want to avoid the risk (not to say confusion) of un-necessary change).
Can someone at Rancher confirm that docker-compose is changed in the way I have suggested and if so, if that can be prevented ?