-
Notifications
You must be signed in to change notification settings - Fork 381
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
Add dependencies between monitor, SLO & dashboards #668
Conversation
@Tony-Proum it looks good. Would you mind adding a test scenario? |
Oh, ok, I thought that the solution may be more complicated, but as it looks good, I'll add a test for this feature |
@jirikuncar I think that those test are able to demonstrate what we are doing here. But I'm not sure that they follow the practices in this repository ( naming / way of writing and so forth ). Feel free to tell me if something is wrong. |
Oh, sorry, I just realized that I forgot to assert that the dashboard were forced to be recreated in the last test I have commit, I'll fix that |
5b78d3e
to
7155738
Compare
@jirikuncar It works on my machine 😆 Do you have any idea on what could go wrong with this ? |
955ad89
to
bc9a103
Compare
I managed to fix the test for MacOs and Windows case by removing the destroyCheck of this test. Even if it was running properly on linux, it seems to have some kind of race condition on mac or windows that's make the test fail for those OS. Do you think that we could omit this check for this particular test ? |
.github/workflows/test.yml
Outdated
@@ -27,6 +27,7 @@ jobs: | |||
env: | |||
GOFLAGS: "-mod=vendor" | |||
strategy: | |||
fail-fast: false |
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.
can you please revert it?
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.
Done
bc9a103
to
f3de3db
Compare
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.
Taking a look at the related issue I'm wondering if there's a way to use the newer force_delete flag on the monitor resource - https://github.com/DataDog/terraform-provider-datadog/pull/535/files to satisfy this use case.
I believe that would avoid having to delete+create any dependent dashboards/SLOs and let those update in place with the new monitor id.
@@ -3802,6 +3802,7 @@ func getServiceLevelObjectiveDefinitionSchema() map[string]*schema.Schema { | |||
"slo_id": { | |||
Type: schema.TypeString, | |||
Required: true, | |||
ForceNew: true, |
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.
Will this cause the whole dashboard to be deleted + recreated if the slo changes? I'm not sure if that'll be expected for users, since it'd mean any dashboard lists or favorited dashboards will need to be updated with the new dashboard id.
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 don't know if it's an issue any more: the dasboard_list can now be handle by the dashboard itself (see: https://github.com/DataDog/terraform-provider-datadog/pull/654/files) so in theory it should works just fine. But I' m agree, delete + recreate could be a little ... overkill 😄
Oh seems to be a way better solution ! (I didn't known that feature exists through the API). If this flag exists on each of this resources: dashboard, slo and monitor, it could do the trick.
I think that it exists a similar link for dashboard and SLO resource (but not sure). So maybe will I have to add this Also, I'm working on another subject today, I'll check when it's possible Finally, I have a question about this Maybe could it be a lot more simpler forcing this attribute in the first place or even to use the delete + recreate solution by default ? I do not have a strong opinion on which solution is better than the other, but I think that the user experience for terraform users could be really impacted by the solution that will emerge |
f3de3db
to
f4438a8
Compare
Hey @Tony-Proum I apologize for my delay here. Please let me know if this isn't the case, but I believe monitors is the only resource that would fail to delete if its referenced in an SLO? So we'd only need the force_delete option there? Originally we decided against enabling forceDelete to be on by default, since the option is designed as a safegaurd (see - #451 (comment)) from inadvertently deleting monitors that are referenced inside an SLO definition. Though I do think the experience could be a bit better. Maybe we could call this out in the error thats logged and raised to the user and explicitly note the force_delete option is available? |
if I remember correctly, when doing some tests, the same validation exists between SLO widget and Dasboards (but I'm not sure anymore). |
@nmuesch I also tried, to change the SLO on a monitor and for this part, I think that the issue were a PEBKAC as I were able to change it without issue. If you are agree with this, I'll remove the IMHO Instead of simply delete the SLO, it seems cumbersome. |
@nmuesch & @jirikuncar just happens to me this morning while trying to modify an SLO: So I finally think that the link exists both between dashboard and slo, and between slo and monitors. |
37caef6
to
c047a8f
Compare
We've added the |
@therve Maybe should this flag be added to monitors as well ? |
Don't know if this could handle of the complexity of this issue : #667
But maybe this simple fix could do the trick