-
Notifications
You must be signed in to change notification settings - Fork 1
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 spurious diff with hidden_queries
#222
Conversation
} | ||
hq := make(map[string]interface{}, len(query.HiddenQueries)) | ||
for k, v := range query.HiddenQueries { | ||
// Don't include the top-level query in the TF resource data |
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.
note that this leads to another unresolvable diff scenario, specifically when the user specifies a hidden_queries
with the top-level query name included (because the HCL will keep trying to add it, and this code will keep omitting it). i am choosing not to fix this in the provider, because i dont know how i think the API should be updated to better handle this case -- in particular, we should omit the top-level query name from hidden_queries
in the API, and use hidden
for that purpose (as the contract has been defined here)
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.
I like this approach
} | ||
hq := make(map[string]interface{}, len(query.HiddenQueries)) | ||
for k, v := range query.HiddenQueries { | ||
// Don't include the top-level query in the TF resource data |
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.
I like this approach
Fixes a spurious diff issue, in which alerts with
hidden_queries
set will continuously try (and fail) to "update". This is caused by a failure to store thehidden_queries
map in state, causing an unresolvable diff between the HCL and the state file.I fixed this by stealing the
hidden_queries
setting code fromlightstep_dashboard
and calling it fromlightstep_alert
, and added a unit test to ensure the plan is clean for these types of alerts now