Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
feat(slo): Update Terraform provider to include option to set min Failures #1660
feat(slo): Update Terraform provider to include option to set min Failures #1660
Changes from 21 commits
98b87a0
5942477
1a7002f
e9f4952
0445042
3a2bf0e
2bd3b5e
89da9fe
ac8ff7d
f837e58
dd33166
543d467
6e600c0
2004487
7493931
982dd7d
f45ffb0
ed7e611
37cfab8
a23c6a7
ff7d165
1995c18
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
it seems that the blocks above this all follow the same pattern with type assertion on the "if" line. Can we not follow that pattern here? Note: the suggestion is using
[]interface{}
not[]int
(type depends on whether you take suggestion above)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.
issue: this will panic if the runtime value of
lf[0]
fails the type assertion.Don't you need to use the
lf2, ok := lf[0].(map[string]interface{})
version and checkok
?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.
Interesting point. Yeah I should fix that.
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.
We actually do this exact same thing for the alerting struct as a whole, the terraform can panic if it doesn't match the expected format. Think I should switch that too?
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.
yes, if it's easy. If we can handle more gracefully than panic, we should.
where else are we doing it though? The only uncheecked type assertions I see in this function are on line 574 and 576
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 actually misunderstood. the alerting struct handles it all gracefully. I've replicated it now 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.
Heh, I guess this works but this could be tested without an additional test function. An import test would've tested that things are written correctly too (it wipes the state and checks that all attributes would be set the same on an import)