-
Notifications
You must be signed in to change notification settings - Fork 63
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
fix: Skip computed stat fields #299
fix: Skip computed stat fields #299
Conversation
a279e53
to
bb7e4c3
Compare
There's a big problem: someone can use some of these fields and we'll get a script that doesn't work. |
@vaerh Changing state breaks the main principle of IaC -- idempotence.
In our case, the state was constantly changing, requiring reuploading the state to the selected backend. This is very inefficient and may lead to extra costs and make debugging more difficult. I think there is no practical or theoretical use case when you need counters in our infrastructure. The resource fields are usually used as dependencies in other resources or outputs, and conditions based on counters will be unreliable. It would make sense to have them in the data sources, but again, that shouldn't be used in any conditions. And the whole idea of having a script (which is imperative) is against the declarative model of Terraform language:
On top of that, having more defined schema fields requires a little bit more maintenance as it's harder to predict them and, therefore, test them. So, pragmatically, excluding them from the resource definitions is better. In the worst case, people using those fields will come back here after bumping the provider. |
Thanks! |
🎉 This PR is included in version 1.25.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
While working with the provider, I discovered that it changes the Terraform state on every apply, even though there are no changes. That's caused by constantly changing stats fields (e.g., number of transferred bytes or packets). That breaks the whole concept of the Terraform state and produces state changes without actual "infrastructure" change.
Apart from that, some resources returned many warnings related to the missing schema fields.
This PR tries to address those problems in a backward-compatible way by reusing the
MetaSkipFields
property:As this PR doesn't explicitly add any new schema fields, the changes are compatible with any supported RouterOS version.