-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Ansible - Fix the diffing engine #1530
Conversation
eafc048
to
0be3c52
Compare
Hi! I'm the modular magician, I work on Magic Modules. Pull request statusesNo diff detected in terraform-provider-google-beta. New Pull RequestsI built this PR into one or more new PRs on other repositories, and when those are closed, this PR will also be merged and closed. |
Hi! I'm the modular magician, I work on Magic Modules. Pull request statusesNo diff detected in terraform-provider-google-beta. New Pull RequestsI didn't open any new pull requests because of this PR. |
Hi! I'm the modular magician, I work on Magic Modules. Pull request statusesNo diff detected in terraform-provider-google-beta. New Pull RequestsI didn't open any new pull requests because of this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be good to take actual values from the problems you've encountered and make some unit tests from them.
@SirGitsalot ptal! |
4953ac3
to
a7d6c07
Compare
@SirGitsalot we had a partial test suite for the difference checker, but I added some tests to address the particular tests (resolving around sorting) that this fixes. |
Hi! I'm the modular magician, I work on Magic Modules. Pull request statusesNo diff detected in terraform-provider-google-beta. New Pull RequestsI didn't open any new pull requests because of this PR. |
Tracked submodules are build/terraform-beta build/terraform-mapper build/terraform build/ansible build/inspec.
a7d6c07
to
adc5bf0
Compare
I had to build my own differ (to determine if Ansible playbook doesn't match GCP state). It's been brittle and I've had intermittent problems. I've found some problems that I've fixed.
The output-only properties make diffing hard. They should be removed. Additionally, there's no reason to send output-only fields in requests. They'll always be blank (Ansible's module validation will error if not)
Python uses True/False, where GCP uses string equivalents. (Fixed this earlier)
Requests use Unicode strings, responses get handed back non-unicode strings. At least in 2.7, Python is terrible about doing proper equality checks between a Unicode string and its non-Unicode equivalent (this makes perfect sense, but makes my life harder).
Even without the output-only properties, the Ansible playbook state will be a subset of the GCP API results. This means I can't do something as simple as
if value in list
.Lists in the Ansible playbooks won't be in the same order GCP returns them.
I tried to clean up the code (to show what's the request + what's the response) and comment all of this to show a list of assumptions + why this is more complicated than one would think.
[all]
[terraform]
[terraform-beta]
[ansible]
[inspec]